<html>
<head>
    <title>Array.js Source Code | Sencha Test 1.0.3</title>
    <!--  Generated on  -->
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="css/styles.css">
</head>
<body>
    <pre class="editor editor-colors"><div class="line"><a name="line1"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line2"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@class</span></span><span>&nbsp;Array</span></span></span></div><div class="line"><a name="line3"><a name="Array"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line4"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;In&nbsp;JavaScript,&nbsp;the&nbsp;`Array`&nbsp;property&nbsp;of&nbsp;the&nbsp;global&nbsp;object&nbsp;is&nbsp;a&nbsp;constructor&nbsp;for</span></span></span></div><div class="line"><a name="line5"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;array&nbsp;instances.</span></span></span></div><div class="line"><a name="line6"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line7"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;An&nbsp;array&nbsp;is&nbsp;a&nbsp;JavaScript&nbsp;object.&nbsp;Note&nbsp;that&nbsp;you&nbsp;shouldn&#39;t&nbsp;use&nbsp;it&nbsp;as&nbsp;an</span></span></span></div><div class="line"><a name="line8"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;associative&nbsp;array,&nbsp;use&nbsp;{@link&nbsp;Object}&nbsp;instead.</span></span></span></div><div class="line"><a name="line9"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line10"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;#&nbsp;Creating&nbsp;an&nbsp;Array</span></span></span></div><div class="line"><a name="line11"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line12"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;creates&nbsp;an&nbsp;array,&nbsp;msgArray,&nbsp;with&nbsp;a&nbsp;length&nbsp;of&nbsp;0,&nbsp;then&nbsp;assigns&nbsp;values&nbsp;to</span></span></span></div><div class="line"><a name="line13"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;msgArray[0]&nbsp;and&nbsp;msgArray[99],&nbsp;changing&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;array&nbsp;to&nbsp;100.</span></span></span></div><div class="line"><a name="line14"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line15"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;msgArray&nbsp;=&nbsp;new&nbsp;Array();</span></span></span></div><div class="line"><a name="line16"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;msgArray[0]&nbsp;=&nbsp;&quot;Hello&quot;;</span></span></span></div><div class="line"><a name="line17"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;msgArray[99]&nbsp;=&nbsp;&quot;world&quot;;</span></span></span></div><div class="line"><a name="line18"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line19"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(msgArray.length&nbsp;==&nbsp;100)</span></span></span></div><div class="line"><a name="line20"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;The&nbsp;length&nbsp;is&nbsp;100.&quot;);</span></span></span></div><div class="line"><a name="line21"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line22"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;#&nbsp;Creating&nbsp;a&nbsp;Two-dimensional&nbsp;Array</span></span></span></div><div class="line"><a name="line23"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line24"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;creates&nbsp;chess&nbsp;board&nbsp;as&nbsp;a&nbsp;two&nbsp;dimensional&nbsp;array&nbsp;of&nbsp;strings.&nbsp;The&nbsp;first&nbsp;move&nbsp;is&nbsp;made&nbsp;by</span></span></span></div><div class="line"><a name="line25"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;copying&nbsp;the&nbsp;&#39;P&#39;&nbsp;in&nbsp;6,4&nbsp;to&nbsp;4,4.&nbsp;The&nbsp;position&nbsp;4,4&nbsp;is&nbsp;left&nbsp;blank.</span></span></span></div><div class="line"><a name="line26"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line27"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;board&nbsp;=</span></span></span></div><div class="line"><a name="line28"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[&nbsp;[&#39;R&#39;,&#39;N&#39;,&#39;B&#39;,&#39;Q&#39;,&#39;K&#39;,&#39;B&#39;,&#39;N&#39;,&#39;R&#39;],</span></span></span></div><div class="line"><a name="line29"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[&#39;P&#39;,&#39;P&#39;,&#39;P&#39;,&#39;P&#39;,&#39;P&#39;,&#39;P&#39;,&#39;P&#39;,&#39;P&#39;],</span></span></span></div><div class="line"><a name="line30"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;],</span></span></span></div><div class="line"><a name="line31"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;],</span></span></span></div><div class="line"><a name="line32"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;],</span></span></span></div><div class="line"><a name="line33"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;,&#39;&nbsp;&#39;],</span></span></span></div><div class="line"><a name="line34"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[&#39;p&#39;,&#39;p&#39;,&#39;p&#39;,&#39;p&#39;,&#39;p&#39;,&#39;p&#39;,&#39;p&#39;,&#39;p&#39;],</span></span></span></div><div class="line"><a name="line35"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[&#39;r&#39;,&#39;n&#39;,&#39;b&#39;,&#39;q&#39;,&#39;k&#39;,&#39;b&#39;,&#39;n&#39;,&#39;r&#39;]];</span></span></span></div><div class="line"><a name="line36"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(board.join(&#39;\n&#39;)&nbsp;+&nbsp;&#39;\n\n&#39;);</span></span></span></div><div class="line"><a name="line37"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line38"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Move&nbsp;King&#39;s&nbsp;Pawn&nbsp;forward&nbsp;2</span></span></span></div><div class="line"><a name="line39"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;board[4][4]&nbsp;=&nbsp;board[6][4];</span></span></span></div><div class="line"><a name="line40"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;board[6][4]&nbsp;=&nbsp;&#39;&nbsp;&#39;;</span></span></span></div><div class="line"><a name="line41"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(board.join(&#39;\n&#39;));</span></span></span></div><div class="line"><a name="line42"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line43"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Here&nbsp;is&nbsp;the&nbsp;output:</span></span></span></div><div class="line"><a name="line44"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line45"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;R,N,B,Q,K,B,N,R</span></span></span></div><div class="line"><a name="line46"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P,P,P,P,P,P,P,P</span></span></span></div><div class="line"><a name="line47"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,</span></span></span></div><div class="line"><a name="line48"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,</span></span></span></div><div class="line"><a name="line49"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,</span></span></span></div><div class="line"><a name="line50"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,</span></span></span></div><div class="line"><a name="line51"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p,p,p,p,p,p,p,p</span></span></span></div><div class="line"><a name="line52"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;r,n,b,q,k,b,n,r</span></span></span></div><div class="line"><a name="line53"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line54"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;R,N,B,Q,K,B,N,R</span></span></span></div><div class="line"><a name="line55"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P,P,P,P,P,P,P,P</span></span></span></div><div class="line"><a name="line56"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,</span></span></span></div><div class="line"><a name="line57"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,</span></span></span></div><div class="line"><a name="line58"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;,&nbsp;,&nbsp;,&nbsp;,p,&nbsp;,&nbsp;,</span></span></span></div><div class="line"><a name="line59"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,&nbsp;,</span></span></span></div><div class="line"><a name="line60"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p,p,p,p,&nbsp;,p,p,p</span></span></span></div><div class="line"><a name="line61"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;r,n,b,q,k,b,n,r</span></span></span></div><div class="line"><a name="line62"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line63"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;#&nbsp;Accessing&nbsp;array&nbsp;elements</span></span></span></div><div class="line"><a name="line64"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line65"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Array&nbsp;elements&nbsp;are&nbsp;nothing&nbsp;less&nbsp;than&nbsp;object&nbsp;properties,&nbsp;so&nbsp;they&nbsp;are&nbsp;accessed&nbsp;as&nbsp;such.</span></span></span></div><div class="line"><a name="line66"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line67"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;myArray&nbsp;=&nbsp;new&nbsp;Array(&quot;Wind&quot;,&nbsp;&quot;Rain&quot;,&nbsp;&quot;Fire&quot;);</span></span></span></div><div class="line"><a name="line68"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myArray[0];&nbsp;//&nbsp;&quot;Wind&quot;</span></span></span></div><div class="line"><a name="line69"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myArray[1];&nbsp;//&nbsp;&quot;Rain&quot;</span></span></span></div><div class="line"><a name="line70"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;etc.</span></span></span></div><div class="line"><a name="line71"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myArray.length;&nbsp;//&nbsp;3</span></span></span></div><div class="line"><a name="line72"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line73"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Even&nbsp;if&nbsp;indices&nbsp;are&nbsp;properties,&nbsp;the&nbsp;following&nbsp;notation&nbsp;throws&nbsp;a&nbsp;syntax&nbsp;error</span></span></span></div><div class="line"><a name="line74"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myArray.2;</span></span></span></div><div class="line"><a name="line75"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line76"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;It&nbsp;should&nbsp;be&nbsp;noted&nbsp;that&nbsp;in&nbsp;JavaScript,&nbsp;object&nbsp;property&nbsp;names&nbsp;are&nbsp;strings.&nbsp;Consequently,</span></span></span></div><div class="line"><a name="line77"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myArray[0]&nbsp;===&nbsp;myArray[&quot;0&quot;];</span></span></span></div><div class="line"><a name="line78"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myArray[1]&nbsp;===&nbsp;myArray[&quot;1&quot;];</span></span></span></div><div class="line"><a name="line79"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;etc.</span></span></span></div><div class="line"><a name="line80"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line81"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;However,&nbsp;this&nbsp;should&nbsp;be&nbsp;considered&nbsp;carefully</span></span></span></div><div class="line"><a name="line82"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myArray[02];&nbsp;//&nbsp;&quot;Fire&quot;.&nbsp;The&nbsp;number&nbsp;02&nbsp;is&nbsp;converted&nbsp;as&nbsp;the&nbsp;&quot;2&quot;&nbsp;string</span></span></span></div><div class="line"><a name="line83"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myArray[&quot;02&quot;];&nbsp;//&nbsp;undefined.&nbsp;There&nbsp;is&nbsp;no&nbsp;property&nbsp;named&nbsp;&quot;02&quot;</span></span></span></div><div class="line"><a name="line84"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line85"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;#&nbsp;Relationship&nbsp;between&nbsp;length&nbsp;and&nbsp;numerical&nbsp;properties</span></span></span></div><div class="line"><a name="line86"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line87"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;An&nbsp;array&#39;s&nbsp;length&nbsp;property&nbsp;and&nbsp;numerical&nbsp;properties&nbsp;are&nbsp;connected.&nbsp;Here&nbsp;is&nbsp;some</span></span></span></div><div class="line"><a name="line88"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;code&nbsp;explaining&nbsp;how&nbsp;this&nbsp;relationship&nbsp;works.</span></span></span></div><div class="line"><a name="line89"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line90"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;a&nbsp;=&nbsp;[];</span></span></span></div><div class="line"><a name="line91"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line92"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a[0]&nbsp;=&nbsp;&#39;a&#39;;</span></span></span></div><div class="line"><a name="line93"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;console.log(a[0]);&nbsp;//&nbsp;&#39;a&#39;</span></span></span></div><div class="line"><a name="line94"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;console.log(a.length);&nbsp;//&nbsp;1</span></span></span></div><div class="line"><a name="line95"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line96"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a[1]&nbsp;=&nbsp;32;</span></span></span></div><div class="line"><a name="line97"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;console.log(a[1]);&nbsp;//&nbsp;32</span></span></span></div><div class="line"><a name="line98"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;console.log(a.length);&nbsp;//&nbsp;2</span></span></span></div><div class="line"><a name="line99"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line100"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a[13]&nbsp;=&nbsp;12345;</span></span></span></div><div class="line"><a name="line101"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;console.log(a[13]);&nbsp;//&nbsp;12345</span></span></span></div><div class="line"><a name="line102"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;console.log(a.length);&nbsp;//&nbsp;14</span></span></span></div><div class="line"><a name="line103"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line104"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a.length&nbsp;=&nbsp;10;</span></span></span></div><div class="line"><a name="line105"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;console.log(a[13]);&nbsp;//&nbsp;undefined,&nbsp;when&nbsp;reducing&nbsp;the&nbsp;length&nbsp;elements&nbsp;after&nbsp;length+1&nbsp;are&nbsp;removed</span></span></span></div><div class="line"><a name="line106"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;console.log(a.length);&nbsp;//&nbsp;10</span></span></span></div><div class="line"><a name="line107"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line108"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;#&nbsp;Creating&nbsp;an&nbsp;array&nbsp;using&nbsp;the&nbsp;result&nbsp;of&nbsp;a&nbsp;match</span></span></span></div><div class="line"><a name="line109"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line110"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;result&nbsp;of&nbsp;a&nbsp;match&nbsp;between&nbsp;a&nbsp;regular&nbsp;expression&nbsp;and&nbsp;a&nbsp;string&nbsp;can&nbsp;create&nbsp;an&nbsp;array.</span></span></span></div><div class="line"><a name="line111"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;array&nbsp;has&nbsp;properties&nbsp;and&nbsp;elements&nbsp;that&nbsp;provide&nbsp;information&nbsp;about&nbsp;the&nbsp;match.&nbsp;An</span></span></span></div><div class="line"><a name="line112"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;array&nbsp;is&nbsp;the&nbsp;return&nbsp;value&nbsp;of&nbsp;RegExp.exec,&nbsp;String.match,&nbsp;and&nbsp;String.replace.&nbsp;To&nbsp;help</span></span></span></div><div class="line"><a name="line113"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;explain&nbsp;these&nbsp;properties&nbsp;and&nbsp;elements,&nbsp;look&nbsp;at&nbsp;the&nbsp;following&nbsp;example&nbsp;and&nbsp;then&nbsp;refer</span></span></span></div><div class="line"><a name="line114"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;to&nbsp;the&nbsp;table&nbsp;below:</span></span></span></div><div class="line"><a name="line115"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line116"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Match&nbsp;one&nbsp;d&nbsp;followed&nbsp;by&nbsp;one&nbsp;or&nbsp;more&nbsp;b&#39;s&nbsp;followed&nbsp;by&nbsp;one&nbsp;d</span></span></span></div><div class="line"><a name="line117"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Remember&nbsp;matched&nbsp;b&#39;s&nbsp;and&nbsp;the&nbsp;following&nbsp;d</span></span></span></div><div class="line"><a name="line118"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Ignore&nbsp;case</span></span></span></div><div class="line"><a name="line119"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line120"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;myRe&nbsp;=&nbsp;/d(b+)(d)/i;</span></span></span></div><div class="line"><a name="line121"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;myArray&nbsp;=&nbsp;myRe.exec(&quot;cdbBdbsbz&quot;);</span></span></span></div><div class="line"><a name="line122"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line123"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;properties&nbsp;and&nbsp;elements&nbsp;returned&nbsp;from&nbsp;this&nbsp;match&nbsp;are&nbsp;as&nbsp;follows:</span></span></span></div><div class="line"><a name="line124"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line125"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line126"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;Property/Element&nbsp;|&nbsp;Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;Example</span></span></span></div><div class="line"><a name="line127"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|:-----------------|:--------------------------------------------------------------------------------------|:-------------------</span></span></span></div><div class="line"><a name="line128"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;`input`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;A&nbsp;read-only&nbsp;property&nbsp;that&nbsp;reflects&nbsp;the&nbsp;original&nbsp;string&nbsp;against&nbsp;which&nbsp;the&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;cdbBdbsbz</span></span></span></div><div class="line"><a name="line129"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;regular&nbsp;expression&nbsp;was&nbsp;matched.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|</span></span></span></div><div class="line"><a name="line130"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;`index`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;A&nbsp;read-only&nbsp;property&nbsp;that&nbsp;is&nbsp;the&nbsp;zero-based&nbsp;index&nbsp;of&nbsp;the&nbsp;match&nbsp;in&nbsp;the&nbsp;string.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;1</span></span></span></div><div class="line"><a name="line131"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;`[0]`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;A&nbsp;read-only&nbsp;element&nbsp;that&nbsp;specifies&nbsp;the&nbsp;last&nbsp;matched&nbsp;characters.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;dbBd</span></span></span></div><div class="line"><a name="line132"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;`[1],&nbsp;...[n]`&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;Read-only&nbsp;elements&nbsp;that&nbsp;specify&nbsp;the&nbsp;parenthesized&nbsp;substring&nbsp;matches,&nbsp;if&nbsp;included&nbsp;in&nbsp;&nbsp;&nbsp;|&nbsp;[1]:&nbsp;bB&nbsp;[2]:&nbsp;d</span></span></span></div><div class="line"><a name="line133"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;the&nbsp;regular&nbsp;expression.&nbsp;The&nbsp;number&nbsp;of&nbsp;possible&nbsp;parenthesized&nbsp;substrings&nbsp;is&nbsp;unlimited.&nbsp;|</span></span></span></div><div class="line"><a name="line134"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line135"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&lt;div&nbsp;class=&quot;notice&quot;&gt;</span></span></span></div><div class="line"><a name="line136"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Documentation&nbsp;for&nbsp;this&nbsp;class&nbsp;comes&nbsp;from&nbsp;[MDN](</span><span class="markup underline link https hyperlink"><span>https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array</span></span><span>)</span></span></span></div><div class="line"><a name="line137"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;and&nbsp;is&nbsp;available&nbsp;under&nbsp;[Creative&nbsp;Commons:&nbsp;Attribution-Sharealike&nbsp;license](</span><span class="markup underline link http hyperlink"><span>http://creativecommons.org/licenses/by-sa/2.0/</span></span><span>).</span></span></span></div><div class="line"><a name="line138"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&lt;/div&gt;</span></span></span></div><div class="line"><a name="line139"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line140"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line141"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line142"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line143"><a name="Array-method-constructor"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;constructor</span></span></span></div><div class="line"><a name="line144"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Creates&nbsp;new&nbsp;Array&nbsp;object.</span></span></span></div><div class="line"><a name="line145"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line146"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;{Number/Object...}&nbsp;[items]&nbsp;Either&nbsp;a&nbsp;number&nbsp;that&nbsp;specifies&nbsp;the&nbsp;length&nbsp;of&nbsp;array&nbsp;or&nbsp;any&nbsp;number&nbsp;of&nbsp;items</span></span></span></div><div class="line"><a name="line147"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;for&nbsp;the&nbsp;array.</span></span></span></div><div class="line"><a name="line148"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line149"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line150"><span class="source js"><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span>&nbsp;Properties</span><span>&nbsp;</span></span></span></div><div class="line"><a name="line151"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line152"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line153"><a name="Array-property-length"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@property</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>length</span></span><span>&nbsp;</span></span></span></span></div><div class="line"><a name="line154"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Reflects&nbsp;the&nbsp;number&nbsp;of&nbsp;elements&nbsp;in&nbsp;an&nbsp;array.</span></span></span></div><div class="line"><a name="line155"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line156"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;value&nbsp;of&nbsp;the&nbsp;`length`&nbsp;property&nbsp;is&nbsp;an&nbsp;integer&nbsp;with&nbsp;a&nbsp;positive&nbsp;sign&nbsp;and&nbsp;a&nbsp;value&nbsp;less&nbsp;than&nbsp;2&nbsp;to&nbsp;the&nbsp;32</span></span></span></div><div class="line"><a name="line157"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;power&nbsp;(232).</span></span></span></div><div class="line"><a name="line158"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line159"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;You&nbsp;can&nbsp;set&nbsp;the&nbsp;`length`&nbsp;property&nbsp;to&nbsp;truncate&nbsp;an&nbsp;array&nbsp;at&nbsp;any&nbsp;time.&nbsp;When&nbsp;you&nbsp;extend&nbsp;an&nbsp;array&nbsp;by&nbsp;changing</span></span></span></div><div class="line"><a name="line160"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;its&nbsp;`length`&nbsp;property,&nbsp;the&nbsp;number&nbsp;of&nbsp;actual&nbsp;elements&nbsp;does&nbsp;not&nbsp;increase;&nbsp;for&nbsp;example,&nbsp;if&nbsp;you&nbsp;set&nbsp;`length`</span></span></span></div><div class="line"><a name="line161"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;to&nbsp;3&nbsp;when&nbsp;it&nbsp;is&nbsp;currently&nbsp;2,&nbsp;the&nbsp;array&nbsp;still&nbsp;contains&nbsp;only&nbsp;2&nbsp;elements.</span></span></span></div><div class="line"><a name="line162"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line163"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;In&nbsp;the&nbsp;following&nbsp;example&nbsp;the&nbsp;array&nbsp;numbers&nbsp;is&nbsp;iterated&nbsp;through&nbsp;by&nbsp;looking&nbsp;at&nbsp;the&nbsp;`length`&nbsp;property&nbsp;to&nbsp;see</span></span></span></div><div class="line"><a name="line164"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;how&nbsp;many&nbsp;elements&nbsp;it&nbsp;has.&nbsp;Each&nbsp;value&nbsp;is&nbsp;then&nbsp;doubled.</span></span></span></div><div class="line"><a name="line165"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line166"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;numbers&nbsp;=&nbsp;[1,2,3,4,5];</span></span></span></div><div class="line"><a name="line167"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(var&nbsp;i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt;&nbsp;numbers.length;&nbsp;i++)&nbsp;{</span></span></span></div><div class="line"><a name="line168"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;numbers[i]&nbsp;*=&nbsp;2;</span></span></span></div><div class="line"><a name="line169"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line170"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;numbers&nbsp;is&nbsp;now&nbsp;[2,4,6,8,10];</span></span></span></div><div class="line"><a name="line171"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line172"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;shortens&nbsp;the&nbsp;array&nbsp;`statesUS`&nbsp;to&nbsp;a&nbsp;length&nbsp;of&nbsp;50&nbsp;if&nbsp;the&nbsp;current&nbsp;`length`&nbsp;is&nbsp;greater</span></span></span></div><div class="line"><a name="line173"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;than&nbsp;50.</span></span></span></div><div class="line"><a name="line174"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line175"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(statesUS.length&nbsp;&gt;&nbsp;50)&nbsp;{</span></span></span></div><div class="line"><a name="line176"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;statesUS.length=50</span></span></span></div><div class="line"><a name="line177"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line178"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line179"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line180"><span class="source js"><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span>&nbsp;Mutator&nbsp;methods.&nbsp;These&nbsp;methods&nbsp;modify&nbsp;the&nbsp;array:</span><span>&nbsp;</span></span></span></div><div class="line"><a name="line181"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line182"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line183"><a name="Array-method-pop"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;pop</span></span></span></div><div class="line"><a name="line184"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;pop&nbsp;method&nbsp;removes&nbsp;the&nbsp;last&nbsp;element&nbsp;from&nbsp;an&nbsp;array&nbsp;and&nbsp;returns&nbsp;that&nbsp;value&nbsp;to&nbsp;the&nbsp;caller.</span></span></span></div><div class="line"><a name="line185"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line186"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`pop`&nbsp;is&nbsp;intentionally&nbsp;generic;&nbsp;this&nbsp;method&nbsp;can&nbsp;be&nbsp;called&nbsp;or&nbsp;applied&nbsp;to&nbsp;objects&nbsp;resembling</span></span></span></div><div class="line"><a name="line187"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;arrays.&nbsp;Objects&nbsp;which&nbsp;do&nbsp;not&nbsp;contain&nbsp;a&nbsp;length&nbsp;property&nbsp;reflecting&nbsp;the&nbsp;last&nbsp;in&nbsp;a&nbsp;series&nbsp;of</span></span></span></div><div class="line"><a name="line188"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;consecutive,&nbsp;zero-based&nbsp;numerical&nbsp;properties&nbsp;may&nbsp;not&nbsp;behave&nbsp;in&nbsp;any&nbsp;meaningful&nbsp;manner.</span></span></span></div><div class="line"><a name="line189"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line190"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;myFish&nbsp;=&nbsp;[&quot;angel&quot;,&nbsp;&quot;clown&quot;,&nbsp;&quot;mandarin&quot;,&nbsp;&quot;surgeon&quot;];</span></span></span></div><div class="line"><a name="line191"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;popped&nbsp;=&nbsp;myFish.pop();</span></span></span></div><div class="line"><a name="line192"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(popped);&nbsp;//&nbsp;Alerts&nbsp;&#39;surgeon&#39;</span></span></span></div><div class="line"><a name="line193"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line194"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Object}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>The</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>last&nbsp;element&nbsp;in&nbsp;the&nbsp;array</span></span></span></span></span></div><div class="line"><a name="line195"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line196"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line197"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line198"><a name="Array-method-push"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;push</span></span></span></div><div class="line"><a name="line199"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Adds&nbsp;one&nbsp;or&nbsp;more&nbsp;elements&nbsp;to&nbsp;the&nbsp;end&nbsp;of&nbsp;an&nbsp;array&nbsp;and&nbsp;returns&nbsp;the&nbsp;new&nbsp;length&nbsp;of&nbsp;the&nbsp;array.</span></span></span></div><div class="line"><a name="line200"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line201"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`push`&nbsp;is&nbsp;intentionally&nbsp;generic.&nbsp;This&nbsp;method&nbsp;can&nbsp;be&nbsp;called&nbsp;or&nbsp;applied&nbsp;to&nbsp;objects&nbsp;resembling</span></span></span></div><div class="line"><a name="line202"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;arrays.&nbsp;The&nbsp;push&nbsp;method&nbsp;relies&nbsp;on&nbsp;a&nbsp;length&nbsp;property&nbsp;to&nbsp;determine&nbsp;where&nbsp;to&nbsp;start&nbsp;inserting</span></span></span></div><div class="line"><a name="line203"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;given&nbsp;values.&nbsp;If&nbsp;the&nbsp;length&nbsp;property&nbsp;cannot&nbsp;be&nbsp;converted&nbsp;into&nbsp;a&nbsp;number,&nbsp;the&nbsp;index&nbsp;used</span></span></span></div><div class="line"><a name="line204"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;is&nbsp;0.&nbsp;This&nbsp;includes&nbsp;the&nbsp;possibility&nbsp;of&nbsp;length&nbsp;being&nbsp;nonexistent,&nbsp;in&nbsp;which&nbsp;case&nbsp;length&nbsp;will</span></span></span></div><div class="line"><a name="line205"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;also&nbsp;be&nbsp;created.</span></span></span></div><div class="line"><a name="line206"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line207"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;only&nbsp;native,&nbsp;array-like&nbsp;objects&nbsp;are&nbsp;strings,&nbsp;although&nbsp;they&nbsp;are&nbsp;not&nbsp;suitable&nbsp;in</span></span></span></div><div class="line"><a name="line208"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;applications&nbsp;of&nbsp;this&nbsp;method,&nbsp;as&nbsp;strings&nbsp;are&nbsp;immutable.</span></span></span></div><div class="line"><a name="line209"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line210"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;###&nbsp;Adding&nbsp;elements&nbsp;to&nbsp;an&nbsp;array</span></span></span></div><div class="line"><a name="line211"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line212"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;code&nbsp;creates&nbsp;the&nbsp;sports&nbsp;array&nbsp;containing&nbsp;two&nbsp;elements,&nbsp;then&nbsp;appends&nbsp;two&nbsp;elements</span></span></span></div><div class="line"><a name="line213"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;to&nbsp;it.&nbsp;After&nbsp;the&nbsp;code&nbsp;executes,&nbsp;sports&nbsp;contains&nbsp;4&nbsp;elements:&nbsp;&quot;soccer&quot;,&nbsp;&quot;baseball&quot;,&nbsp;&quot;football&quot;</span></span></span></div><div class="line"><a name="line214"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;and&nbsp;&quot;swimming&quot;.</span></span></span></div><div class="line"><a name="line215"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line216"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;sports&nbsp;=&nbsp;[&quot;soccer&quot;,&nbsp;&quot;baseball&quot;];</span></span></span></div><div class="line"><a name="line217"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sports.push(&quot;football&quot;,&nbsp;&quot;swimming&quot;);</span></span></span></div><div class="line"><a name="line218"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line219"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;{Object...}&nbsp;elements&nbsp;The&nbsp;elements&nbsp;to&nbsp;add&nbsp;to&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;array.</span></span></span></div><div class="line"><a name="line220"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>The</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>new&nbsp;length&nbsp;property&nbsp;of&nbsp;the&nbsp;object&nbsp;upon&nbsp;which&nbsp;the&nbsp;method&nbsp;was&nbsp;called.</span></span></span></span></span></div><div class="line"><a name="line221"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line222"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line223"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line224"><a name="Array-method-reverse"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;reverse</span></span></span></div><div class="line"><a name="line225"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Reverses&nbsp;the&nbsp;order&nbsp;of&nbsp;the&nbsp;elements&nbsp;of&nbsp;an&nbsp;array&nbsp;--&nbsp;the&nbsp;first&nbsp;becomes&nbsp;the&nbsp;last,&nbsp;and&nbsp;the</span></span></span></div><div class="line"><a name="line226"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;last&nbsp;becomes&nbsp;the&nbsp;first.</span></span></span></div><div class="line"><a name="line227"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line228"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;reverse&nbsp;method&nbsp;transposes&nbsp;the&nbsp;elements&nbsp;of&nbsp;the&nbsp;calling&nbsp;array&nbsp;object&nbsp;in&nbsp;place,&nbsp;mutating&nbsp;the</span></span></span></div><div class="line"><a name="line229"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;array,&nbsp;and&nbsp;returning&nbsp;a&nbsp;reference&nbsp;to&nbsp;the&nbsp;array.</span></span></span></div><div class="line"><a name="line230"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line231"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;creates&nbsp;an&nbsp;array&nbsp;myArray,&nbsp;containing&nbsp;three&nbsp;elements,&nbsp;then&nbsp;reverses&nbsp;the&nbsp;array.</span></span></span></div><div class="line"><a name="line232"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line233"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;myArray&nbsp;=&nbsp;[&quot;one&quot;,&nbsp;&quot;two&quot;,&nbsp;&quot;three&quot;];</span></span></span></div><div class="line"><a name="line234"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myArray.reverse();</span></span></span></div><div class="line"><a name="line235"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line236"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;code&nbsp;changes&nbsp;myArray&nbsp;so&nbsp;that:</span></span></span></div><div class="line"><a name="line237"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line238"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;-&nbsp;myArray[0]&nbsp;is&nbsp;&quot;three&quot;</span></span></span></div><div class="line"><a name="line239"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;-&nbsp;myArray[1]&nbsp;is&nbsp;&quot;two&quot;</span></span></span></div><div class="line"><a name="line240"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;-&nbsp;myArray[2]&nbsp;is&nbsp;&quot;one&quot;</span></span></span></div><div class="line"><a name="line241"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line242"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Array}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>A</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>reference&nbsp;to&nbsp;the&nbsp;array</span></span></span></span></span></div><div class="line"><a name="line243"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line244"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line245"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line246"><a name="Array-method-shift"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;shift</span></span></span></div><div class="line"><a name="line247"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Removes&nbsp;the&nbsp;first&nbsp;element&nbsp;from&nbsp;an&nbsp;array&nbsp;and&nbsp;returns&nbsp;that&nbsp;element.</span></span></span></div><div class="line"><a name="line248"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line249"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;`shift`&nbsp;method&nbsp;removes&nbsp;the&nbsp;element&nbsp;at&nbsp;the&nbsp;zeroeth&nbsp;index&nbsp;and&nbsp;shifts&nbsp;the&nbsp;values&nbsp;at&nbsp;consecutive</span></span></span></div><div class="line"><a name="line250"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;indexes&nbsp;down,&nbsp;then&nbsp;returns&nbsp;the&nbsp;removed&nbsp;value.</span></span></span></div><div class="line"><a name="line251"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line252"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`shift`&nbsp;is&nbsp;intentionally&nbsp;generic;&nbsp;this&nbsp;method&nbsp;can&nbsp;be&nbsp;called&nbsp;or&nbsp;applied&nbsp;to&nbsp;objects&nbsp;resembling</span></span></span></div><div class="line"><a name="line253"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;arrays.&nbsp;Objects&nbsp;which&nbsp;do&nbsp;not&nbsp;contain&nbsp;a&nbsp;`length`&nbsp;property&nbsp;reflecting&nbsp;the&nbsp;last&nbsp;in&nbsp;a&nbsp;series&nbsp;of</span></span></span></div><div class="line"><a name="line254"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;consecutive,&nbsp;zero-based&nbsp;numerical&nbsp;properties&nbsp;may&nbsp;not&nbsp;behave&nbsp;in&nbsp;any&nbsp;meaningful&nbsp;manner.</span></span></span></div><div class="line"><a name="line255"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line256"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;code&nbsp;displays&nbsp;the&nbsp;`myFish`&nbsp;array&nbsp;before&nbsp;and&nbsp;after&nbsp;removing&nbsp;its&nbsp;first&nbsp;element.&nbsp;It&nbsp;also</span></span></span></div><div class="line"><a name="line257"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;displays&nbsp;the&nbsp;removed&nbsp;element:</span></span></span></div><div class="line"><a name="line258"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line259"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;assumes&nbsp;a&nbsp;println&nbsp;function&nbsp;is&nbsp;defined</span></span></span></div><div class="line"><a name="line260"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;myFish&nbsp;=&nbsp;[&quot;angel&quot;,&nbsp;&quot;clown&quot;,&nbsp;&quot;mandarin&quot;,&nbsp;&quot;surgeon&quot;];</span></span></span></div><div class="line"><a name="line261"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;println(&quot;myFish&nbsp;before:&nbsp;&quot;&nbsp;+&nbsp;myFish);</span></span></span></div><div class="line"><a name="line262"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;shifted&nbsp;=&nbsp;myFish.shift();</span></span></span></div><div class="line"><a name="line263"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;println(&quot;myFish&nbsp;after:&nbsp;&quot;&nbsp;+&nbsp;myFish);</span></span></span></div><div class="line"><a name="line264"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;println(&quot;Removed&nbsp;this&nbsp;element:&nbsp;&quot;&nbsp;+&nbsp;shifted);</span></span></span></div><div class="line"><a name="line265"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line266"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;example&nbsp;displays&nbsp;the&nbsp;following:</span></span></span></div><div class="line"><a name="line267"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line268"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myFish&nbsp;before:&nbsp;angel,clown,mandarin,surgeon</span></span></span></div><div class="line"><a name="line269"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myFish&nbsp;after:&nbsp;clown,mandarin,surgeon</span></span></span></div><div class="line"><a name="line270"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Removed&nbsp;this&nbsp;element:&nbsp;angel</span></span></span></div><div class="line"><a name="line271"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line272"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Object}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>The</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>first&nbsp;element&nbsp;of&nbsp;the&nbsp;array&nbsp;prior&nbsp;to&nbsp;shifting.</span></span></span></span></span></div><div class="line"><a name="line273"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line274"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line275"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line276"><a name="Array-method-sort"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;sort</span></span></span></div><div class="line"><a name="line277"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Sorts&nbsp;the&nbsp;elements&nbsp;of&nbsp;an&nbsp;array.</span></span></span></div><div class="line"><a name="line278"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line279"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;`compareFunction`&nbsp;is&nbsp;not&nbsp;supplied,&nbsp;elements&nbsp;are&nbsp;sorted&nbsp;by&nbsp;converting&nbsp;them&nbsp;to&nbsp;strings&nbsp;and</span></span></span></div><div class="line"><a name="line280"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;comparing&nbsp;strings&nbsp;in&nbsp;lexicographic&nbsp;(&quot;dictionary&quot;&nbsp;or&nbsp;&quot;telephone&nbsp;book,&quot;&nbsp;not&nbsp;numerical)&nbsp;order.&nbsp;For</span></span></span></div><div class="line"><a name="line281"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;example,&nbsp;&quot;80&quot;&nbsp;comes&nbsp;before&nbsp;&quot;9&quot;&nbsp;in&nbsp;lexicographic&nbsp;order,&nbsp;but&nbsp;in&nbsp;a&nbsp;numeric&nbsp;sort&nbsp;9&nbsp;comes&nbsp;before&nbsp;80.</span></span></span></div><div class="line"><a name="line282"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line283"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;`compareFunction`&nbsp;is&nbsp;supplied,&nbsp;the&nbsp;array&nbsp;elements&nbsp;are&nbsp;sorted&nbsp;according&nbsp;to&nbsp;the&nbsp;return&nbsp;value&nbsp;of</span></span></span></div><div class="line"><a name="line284"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;compare&nbsp;function.&nbsp;If&nbsp;a&nbsp;and&nbsp;b&nbsp;are&nbsp;two&nbsp;elements&nbsp;being&nbsp;compared,&nbsp;then:</span></span></span></div><div class="line"><a name="line285"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;`compareFunction(a,&nbsp;b)`&nbsp;is&nbsp;less&nbsp;than&nbsp;0,&nbsp;sort&nbsp;`a`&nbsp;to&nbsp;a&nbsp;lower&nbsp;index&nbsp;than&nbsp;`b`.</span></span></span></div><div class="line"><a name="line286"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;`compareFunction(a,&nbsp;b)`&nbsp;returns&nbsp;0,&nbsp;leave&nbsp;`a`&nbsp;and&nbsp;`b`&nbsp;unchanged&nbsp;with&nbsp;respect&nbsp;to&nbsp;each&nbsp;other,&nbsp;but</span></span></span></div><div class="line"><a name="line287"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;sorted&nbsp;with&nbsp;respect&nbsp;to&nbsp;all&nbsp;different&nbsp;elements.&nbsp;Note:&nbsp;the&nbsp;ECMAscript&nbsp;standard&nbsp;does&nbsp;not&nbsp;guarantee</span></span></span></div><div class="line"><a name="line288"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;this&nbsp;behaviour,&nbsp;and&nbsp;thus&nbsp;not&nbsp;all&nbsp;browsers&nbsp;respect&nbsp;this.</span></span></span></div><div class="line"><a name="line289"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;`compareFunction(a,&nbsp;b)`&nbsp;is&nbsp;greater&nbsp;than&nbsp;0,&nbsp;sort&nbsp;`b`&nbsp;to&nbsp;a&nbsp;lower&nbsp;index&nbsp;than&nbsp;`a`.</span></span></span></div><div class="line"><a name="line290"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`compareFunction(a,&nbsp;b)`&nbsp;must&nbsp;always&nbsp;returns&nbsp;the&nbsp;same&nbsp;value&nbsp;when&nbsp;given&nbsp;a&nbsp;specific&nbsp;pair&nbsp;of&nbsp;elements&nbsp;a</span></span></span></div><div class="line"><a name="line291"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;and&nbsp;b&nbsp;as&nbsp;its&nbsp;two&nbsp;arguments.&nbsp;If&nbsp;inconsistent&nbsp;results&nbsp;are&nbsp;returned&nbsp;then&nbsp;the&nbsp;sort&nbsp;order&nbsp;is&nbsp;undefined</span></span></span></div><div class="line"><a name="line292"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line293"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;So,&nbsp;the&nbsp;compare&nbsp;function&nbsp;has&nbsp;the&nbsp;following&nbsp;form:</span></span></span></div><div class="line"><a name="line294"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line295"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;compare(a,&nbsp;b)</span></span></span></div><div class="line"><a name="line296"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span></span></span></div><div class="line"><a name="line297"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(a&nbsp;is&nbsp;less&nbsp;than&nbsp;b&nbsp;by&nbsp;some&nbsp;ordering&nbsp;criterion)</span></span></span></div><div class="line"><a name="line298"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;-1;</span></span></span></div><div class="line"><a name="line299"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(a&nbsp;is&nbsp;greater&nbsp;than&nbsp;b&nbsp;by&nbsp;the&nbsp;ordering&nbsp;criterion)</span></span></span></div><div class="line"><a name="line300"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;1;</span></span></span></div><div class="line"><a name="line301"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;a&nbsp;must&nbsp;be&nbsp;equal&nbsp;to&nbsp;b</span></span></span></div><div class="line"><a name="line302"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;0;</span></span></span></div><div class="line"><a name="line303"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line304"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line305"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;To&nbsp;compare&nbsp;numbers&nbsp;instead&nbsp;of&nbsp;strings,&nbsp;the&nbsp;compare&nbsp;function&nbsp;can&nbsp;simply&nbsp;subtract&nbsp;`b`&nbsp;from&nbsp;`a`:</span></span></span></div><div class="line"><a name="line306"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line307"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;compareNumbers(a,&nbsp;b)</span></span></span></div><div class="line"><a name="line308"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span></span></span></div><div class="line"><a name="line309"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;a&nbsp;-&nbsp;b;</span></span></span></div><div class="line"><a name="line310"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line311"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line312"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;sort()&nbsp;method&nbsp;can&nbsp;be&nbsp;conveniently&nbsp;used&nbsp;with&nbsp;closures:</span></span></span></div><div class="line"><a name="line313"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line314"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;numbers&nbsp;=&nbsp;[4,&nbsp;2,&nbsp;5,&nbsp;1,&nbsp;3];</span></span></span></div><div class="line"><a name="line315"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;numbers.sort(function(a,&nbsp;b)&nbsp;{</span></span></span></div><div class="line"><a name="line316"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;a&nbsp;-&nbsp;b;</span></span></span></div><div class="line"><a name="line317"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});</span></span></span></div><div class="line"><a name="line318"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(numbers);</span></span></span></div><div class="line"><a name="line319"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line320"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Function}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>compareFunction</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>Specifies&nbsp;a&nbsp;function&nbsp;that&nbsp;defines&nbsp;the&nbsp;sort&nbsp;order.&nbsp;If&nbsp;omitted,&nbsp;the</span></span></span></span></span></div><div class="line"><a name="line321"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;array&nbsp;is&nbsp;sorted&nbsp;lexicographically&nbsp;(in&nbsp;dictionary&nbsp;order)&nbsp;according&nbsp;to&nbsp;the&nbsp;string&nbsp;conversion&nbsp;of&nbsp;each</span></span></span></div><div class="line"><a name="line322"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;element.</span></span></span></div><div class="line"><a name="line323"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Array}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>A</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>reference&nbsp;to&nbsp;the&nbsp;array</span></span></span></span></span></div><div class="line"><a name="line324"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line325"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line326"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line327"><a name="Array-method-splice"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;splice</span></span></span></div><div class="line"><a name="line328"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Adds&nbsp;and/or&nbsp;removes&nbsp;elements&nbsp;from&nbsp;an&nbsp;array.</span></span></span></div><div class="line"><a name="line329"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line330"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;you&nbsp;specify&nbsp;a&nbsp;different&nbsp;number&nbsp;of&nbsp;elements&nbsp;to&nbsp;insert&nbsp;than&nbsp;the&nbsp;number&nbsp;you&#39;re&nbsp;removing,&nbsp;the&nbsp;array</span></span></span></div><div class="line"><a name="line331"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;will&nbsp;have&nbsp;a&nbsp;different&nbsp;length&nbsp;at&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;call.</span></span></span></div><div class="line"><a name="line332"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line333"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;assumes&nbsp;a&nbsp;print&nbsp;function&nbsp;is&nbsp;defined</span></span></span></div><div class="line"><a name="line334"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;myFish&nbsp;=&nbsp;[&quot;angel&quot;,&nbsp;&quot;clown&quot;,&nbsp;&quot;mandarin&quot;,&nbsp;&quot;surgeon&quot;];</span></span></span></div><div class="line"><a name="line335"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;myFish:&nbsp;&quot;&nbsp;+&nbsp;myFish);</span></span></span></div><div class="line"><a name="line336"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line337"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;removed&nbsp;=&nbsp;myFish.splice(2,&nbsp;0,&nbsp;&quot;drum&quot;);</span></span></span></div><div class="line"><a name="line338"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;After&nbsp;adding&nbsp;1:&nbsp;&quot;&nbsp;+&nbsp;myFish);</span></span></span></div><div class="line"><a name="line339"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;removed&nbsp;is:&nbsp;&quot;&nbsp;+&nbsp;removed);</span></span></span></div><div class="line"><a name="line340"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line341"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;removed&nbsp;=&nbsp;myFish.splice(3,&nbsp;1);</span></span></span></div><div class="line"><a name="line342"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;After&nbsp;removing&nbsp;1:&nbsp;&quot;&nbsp;+&nbsp;myFish);</span></span></span></div><div class="line"><a name="line343"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;removed&nbsp;is:&nbsp;&quot;&nbsp;+&nbsp;removed);</span></span></span></div><div class="line"><a name="line344"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line345"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;removed&nbsp;=&nbsp;myFish.splice(2,&nbsp;1,&nbsp;&quot;trumpet&quot;);</span></span></span></div><div class="line"><a name="line346"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;After&nbsp;replacing&nbsp;1:&nbsp;&quot;&nbsp;+&nbsp;myFish);</span></span></span></div><div class="line"><a name="line347"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;removed&nbsp;is:&nbsp;&quot;&nbsp;+&nbsp;removed);</span></span></span></div><div class="line"><a name="line348"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line349"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;removed&nbsp;=&nbsp;myFish.splice(0,&nbsp;2,&nbsp;&quot;parrot&quot;,&nbsp;&quot;anemone&quot;,&nbsp;&quot;blue&quot;);</span></span></span></div><div class="line"><a name="line350"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;After&nbsp;replacing&nbsp;2:&nbsp;&quot;&nbsp;+&nbsp;myFish);</span></span></span></div><div class="line"><a name="line351"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;removed&nbsp;is:&nbsp;&quot;&nbsp;+&nbsp;removed);</span></span></span></div><div class="line"><a name="line352"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line353"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;script&nbsp;displays:</span></span></span></div><div class="line"><a name="line354"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line355"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myFish:&nbsp;angel,clown,mandarin,surgeon</span></span></span></div><div class="line"><a name="line356"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;After&nbsp;adding&nbsp;1:&nbsp;angel,clown,drum,mandarin,surgeon</span></span></span></div><div class="line"><a name="line357"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;removed&nbsp;is:</span></span></span></div><div class="line"><a name="line358"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;After&nbsp;removing&nbsp;1:&nbsp;angel,clown,drum,surgeon</span></span></span></div><div class="line"><a name="line359"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;removed&nbsp;is:&nbsp;mandarin</span></span></span></div><div class="line"><a name="line360"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;After&nbsp;replacing&nbsp;1:&nbsp;angel,clown,trumpet,surgeon</span></span></span></div><div class="line"><a name="line361"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;removed&nbsp;is:&nbsp;drum</span></span></span></div><div class="line"><a name="line362"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;After&nbsp;replacing&nbsp;2:&nbsp;parrot,anemone,blue,trumpet,surgeon</span></span></span></div><div class="line"><a name="line363"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;removed&nbsp;is:&nbsp;angel,clown</span></span></span></div><div class="line"><a name="line364"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line365"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>index</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>Index&nbsp;at&nbsp;which&nbsp;to&nbsp;start&nbsp;changing&nbsp;the&nbsp;array.&nbsp;If&nbsp;negative,&nbsp;will&nbsp;begin&nbsp;that</span></span></span></span></span></div><div class="line"><a name="line366"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;many&nbsp;elements&nbsp;from&nbsp;the&nbsp;end.</span></span></span></div><div class="line"><a name="line367"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>howMany</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>An&nbsp;integer&nbsp;indicating&nbsp;the&nbsp;number&nbsp;of&nbsp;old&nbsp;array&nbsp;elements&nbsp;to&nbsp;remove.&nbsp;If</span></span></span></span></span></div><div class="line"><a name="line368"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`howMany`&nbsp;is&nbsp;0,&nbsp;no&nbsp;elements&nbsp;are&nbsp;removed.&nbsp;In&nbsp;this&nbsp;case,&nbsp;you&nbsp;should&nbsp;specify&nbsp;at&nbsp;least&nbsp;one&nbsp;new&nbsp;element.</span></span></span></div><div class="line"><a name="line369"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;no&nbsp;`howMany`&nbsp;parameter&nbsp;is&nbsp;specified&nbsp;all&nbsp;elements&nbsp;after&nbsp;index&nbsp;are&nbsp;removed.</span></span></span></div><div class="line"><a name="line370"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;{Object...}&nbsp;elements&nbsp;The&nbsp;elements&nbsp;to&nbsp;add&nbsp;to&nbsp;the&nbsp;array.&nbsp;If&nbsp;you&nbsp;don&#39;t&nbsp;specify&nbsp;any</span></span></span></div><div class="line"><a name="line371"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;elements,&nbsp;`splice`&nbsp;simply&nbsp;removes&nbsp;elements&nbsp;from&nbsp;the&nbsp;array.</span></span></span></div><div class="line"><a name="line372"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Array}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>An</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>array&nbsp;containing&nbsp;the&nbsp;removed&nbsp;elements.&nbsp;If&nbsp;only&nbsp;one&nbsp;element&nbsp;is&nbsp;removed,&nbsp;an&nbsp;array</span></span></span></span></span></div><div class="line"><a name="line373"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;of&nbsp;one&nbsp;element&nbsp;is&nbsp;returned..</span></span></span></div><div class="line"><a name="line374"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line375"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line376"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line377"><a name="Array-method-unshift"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;unshift</span></span></span></div><div class="line"><a name="line378"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Adds&nbsp;one&nbsp;or&nbsp;more&nbsp;elements&nbsp;to&nbsp;the&nbsp;front&nbsp;of&nbsp;an&nbsp;array&nbsp;and&nbsp;returns&nbsp;the&nbsp;new&nbsp;length&nbsp;of&nbsp;the&nbsp;array.</span></span></span></div><div class="line"><a name="line379"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line380"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;`unshift`&nbsp;method&nbsp;inserts&nbsp;the&nbsp;given&nbsp;values&nbsp;to&nbsp;the&nbsp;beginning&nbsp;of&nbsp;an&nbsp;array-like&nbsp;object.</span></span></span></div><div class="line"><a name="line381"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line382"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`unshift`&nbsp;is&nbsp;intentionally&nbsp;generic;&nbsp;this&nbsp;method&nbsp;can&nbsp;be&nbsp;called&nbsp;or&nbsp;applied&nbsp;to&nbsp;objects&nbsp;resembling</span></span></span></div><div class="line"><a name="line383"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;arrays.&nbsp;Objects&nbsp;which&nbsp;do&nbsp;not&nbsp;contain&nbsp;a&nbsp;`length`&nbsp;property&nbsp;reflecting&nbsp;the&nbsp;last&nbsp;in&nbsp;a&nbsp;series&nbsp;of</span></span></span></div><div class="line"><a name="line384"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;consecutive,&nbsp;zero-based&nbsp;numerical&nbsp;properties&nbsp;may&nbsp;not&nbsp;behave&nbsp;in&nbsp;any&nbsp;meaningful&nbsp;manner.</span></span></span></div><div class="line"><a name="line385"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line386"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;code&nbsp;displays&nbsp;the&nbsp;myFish&nbsp;array&nbsp;before&nbsp;and&nbsp;after&nbsp;adding&nbsp;elements&nbsp;to&nbsp;it.</span></span></span></div><div class="line"><a name="line387"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line388"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;assumes&nbsp;a&nbsp;println&nbsp;function&nbsp;exists</span></span></span></div><div class="line"><a name="line389"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myFish&nbsp;=&nbsp;[&quot;angel&quot;,&nbsp;&quot;clown&quot;];</span></span></span></div><div class="line"><a name="line390"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;println(&quot;myFish&nbsp;before:&nbsp;&quot;&nbsp;+&nbsp;myFish);</span></span></span></div><div class="line"><a name="line391"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unshifted&nbsp;=&nbsp;myFish.unshift(&quot;drum&quot;,&nbsp;&quot;lion&quot;);</span></span></span></div><div class="line"><a name="line392"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;println(&quot;myFish&nbsp;after:&nbsp;&quot;&nbsp;+&nbsp;myFish);</span></span></span></div><div class="line"><a name="line393"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;println(&quot;New&nbsp;length:&nbsp;&quot;&nbsp;+&nbsp;unshifted);</span></span></span></div><div class="line"><a name="line394"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line395"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;example&nbsp;displays&nbsp;the&nbsp;following:</span></span></span></div><div class="line"><a name="line396"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line397"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myFish&nbsp;before:&nbsp;[&quot;angel&quot;,&nbsp;&quot;clown&quot;]</span></span></span></div><div class="line"><a name="line398"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myFish&nbsp;after:&nbsp;[&quot;drum&quot;,&nbsp;&quot;lion&quot;,&nbsp;&quot;angel&quot;,&nbsp;&quot;clown&quot;]</span></span></span></div><div class="line"><a name="line399"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;New&nbsp;length:&nbsp;4</span></span></span></div><div class="line"><a name="line400"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line401"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;{Object...}&nbsp;elements&nbsp;The&nbsp;elements&nbsp;to&nbsp;add&nbsp;to&nbsp;the&nbsp;front&nbsp;of&nbsp;the&nbsp;array.</span></span></span></div><div class="line"><a name="line402"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>The</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>array&#39;s&nbsp;new&nbsp;length.</span></span></span></span></span></div><div class="line"><a name="line403"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line404"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line405"><span class="source js"><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span>&nbsp;Accessor&nbsp;methods.&nbsp;These&nbsp;methods&nbsp;do&nbsp;not&nbsp;modify&nbsp;the&nbsp;array&nbsp;and&nbsp;return&nbsp;some&nbsp;representation&nbsp;of&nbsp;the&nbsp;array.</span><span>&nbsp;</span></span></span></div><div class="line"><a name="line406"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line407"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line408"><a name="Array-method-concat"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;concat</span></span></span></div><div class="line"><a name="line409"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Returns&nbsp;a&nbsp;new&nbsp;array&nbsp;comprised&nbsp;of&nbsp;this&nbsp;array&nbsp;joined&nbsp;with&nbsp;other&nbsp;array(s)&nbsp;and/or&nbsp;value(s).</span></span></span></div><div class="line"><a name="line410"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line411"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`concat`&nbsp;creates&nbsp;a&nbsp;new&nbsp;array&nbsp;consisting&nbsp;of&nbsp;the&nbsp;elements&nbsp;in&nbsp;the&nbsp;`this`&nbsp;object&nbsp;on&nbsp;which&nbsp;it&nbsp;is&nbsp;called,</span></span></span></div><div class="line"><a name="line412"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;followed&nbsp;in&nbsp;order&nbsp;by,&nbsp;for&nbsp;each&nbsp;argument,&nbsp;the&nbsp;elements&nbsp;of&nbsp;that&nbsp;argument&nbsp;(if&nbsp;the&nbsp;argument&nbsp;is&nbsp;an</span></span></span></div><div class="line"><a name="line413"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;array)&nbsp;or&nbsp;the&nbsp;argument&nbsp;itself&nbsp;(if&nbsp;the&nbsp;argument&nbsp;is&nbsp;not&nbsp;an&nbsp;array).</span></span></span></div><div class="line"><a name="line414"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line415"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`concat`&nbsp;does&nbsp;not&nbsp;alter&nbsp;`this`&nbsp;or&nbsp;any&nbsp;of&nbsp;the&nbsp;arrays&nbsp;provided&nbsp;as&nbsp;arguments&nbsp;but&nbsp;instead&nbsp;returns&nbsp;a</span></span></span></div><div class="line"><a name="line416"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&quot;one&nbsp;level&nbsp;deep&quot;&nbsp;copy&nbsp;that&nbsp;contains&nbsp;copies&nbsp;of&nbsp;the&nbsp;same&nbsp;elements&nbsp;combined&nbsp;from&nbsp;the&nbsp;original&nbsp;arrays.</span></span></span></div><div class="line"><a name="line417"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Elements&nbsp;of&nbsp;the&nbsp;original&nbsp;arrays&nbsp;are&nbsp;copied&nbsp;into&nbsp;the&nbsp;new&nbsp;array&nbsp;as&nbsp;follows:</span></span></span></div><div class="line"><a name="line418"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Object&nbsp;references&nbsp;(and&nbsp;not&nbsp;the&nbsp;actual&nbsp;object):&nbsp;`concat`&nbsp;copies&nbsp;object&nbsp;references&nbsp;into&nbsp;the&nbsp;new</span></span></span></div><div class="line"><a name="line419"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;array.&nbsp;Both&nbsp;the&nbsp;original&nbsp;and&nbsp;new&nbsp;array&nbsp;refer&nbsp;to&nbsp;the&nbsp;same&nbsp;object.&nbsp;That&nbsp;is,&nbsp;if&nbsp;a&nbsp;referenced&nbsp;object&nbsp;is</span></span></span></div><div class="line"><a name="line420"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;modified,&nbsp;the&nbsp;changes&nbsp;are&nbsp;visible&nbsp;to&nbsp;both&nbsp;the&nbsp;new&nbsp;and&nbsp;original&nbsp;arrays.</span></span></span></div><div class="line"><a name="line421"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Strings&nbsp;and&nbsp;numbers&nbsp;(not&nbsp;{@link&nbsp;String}&nbsp;and&nbsp;{@link&nbsp;Number}&nbsp;objects):&nbsp;`concat`&nbsp;copies&nbsp;the&nbsp;values&nbsp;of</span></span></span></div><div class="line"><a name="line422"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;strings&nbsp;and&nbsp;numbers&nbsp;into&nbsp;the&nbsp;new&nbsp;array.</span></span></span></div><div class="line"><a name="line423"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line424"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Any&nbsp;operation&nbsp;on&nbsp;the&nbsp;new&nbsp;array&nbsp;will&nbsp;have&nbsp;no&nbsp;effect&nbsp;on&nbsp;the&nbsp;original&nbsp;arrays,&nbsp;and&nbsp;vice&nbsp;versa.</span></span></span></div><div class="line"><a name="line425"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line426"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;###&nbsp;Concatenating&nbsp;two&nbsp;arrays</span></span></span></div><div class="line"><a name="line427"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line428"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;code&nbsp;concatenates&nbsp;two&nbsp;arrays:</span></span></span></div><div class="line"><a name="line429"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line430"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;alpha&nbsp;=&nbsp;[&quot;a&quot;,&nbsp;&quot;b&quot;,&nbsp;&quot;c&quot;];</span></span></span></div><div class="line"><a name="line431"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;numeric&nbsp;=&nbsp;[1,&nbsp;2,&nbsp;3];</span></span></span></div><div class="line"><a name="line432"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line433"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;creates&nbsp;array&nbsp;[&quot;a&quot;,&nbsp;&quot;b&quot;,&nbsp;&quot;c&quot;,&nbsp;1,&nbsp;2,&nbsp;3];&nbsp;alpha&nbsp;and&nbsp;numeric&nbsp;are&nbsp;unchanged</span></span></span></div><div class="line"><a name="line434"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;alphaNumeric&nbsp;=&nbsp;alpha.concat(numeric);</span></span></span></div><div class="line"><a name="line435"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line436"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;###&nbsp;Concatenating&nbsp;three&nbsp;arrays</span></span></span></div><div class="line"><a name="line437"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line438"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;code&nbsp;concatenates&nbsp;three&nbsp;arrays:</span></span></span></div><div class="line"><a name="line439"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line440"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;num1&nbsp;=&nbsp;[1,&nbsp;2,&nbsp;3];</span></span></span></div><div class="line"><a name="line441"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;num2&nbsp;=&nbsp;[4,&nbsp;5,&nbsp;6];</span></span></span></div><div class="line"><a name="line442"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;num3&nbsp;=&nbsp;[7,&nbsp;8,&nbsp;9];</span></span></span></div><div class="line"><a name="line443"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line444"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;creates&nbsp;array&nbsp;[1,&nbsp;2,&nbsp;3,&nbsp;4,&nbsp;5,&nbsp;6,&nbsp;7,&nbsp;8,&nbsp;9];&nbsp;num1,&nbsp;num2,&nbsp;num3&nbsp;are&nbsp;unchanged</span></span></span></div><div class="line"><a name="line445"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;nums&nbsp;=&nbsp;num1.concat(num2,&nbsp;num3);</span></span></span></div><div class="line"><a name="line446"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line447"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;###&nbsp;Concatenating&nbsp;values&nbsp;to&nbsp;an&nbsp;array</span></span></span></div><div class="line"><a name="line448"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line449"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;code&nbsp;concatenates&nbsp;three&nbsp;values&nbsp;to&nbsp;an&nbsp;array:</span></span></span></div><div class="line"><a name="line450"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line451"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;alpha&nbsp;=&nbsp;[&#39;a&#39;,&nbsp;&#39;b&#39;,&nbsp;&#39;c&#39;];</span></span></span></div><div class="line"><a name="line452"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line453"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;creates&nbsp;array&nbsp;[&quot;a&quot;,&nbsp;&quot;b&quot;,&nbsp;&quot;c&quot;,&nbsp;1,&nbsp;2,&nbsp;3],&nbsp;leaving&nbsp;alpha&nbsp;unchanged</span></span></span></div><div class="line"><a name="line454"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;alphaNumeric&nbsp;=&nbsp;alpha.concat(1,&nbsp;[2,&nbsp;3]);</span></span></span></div><div class="line"><a name="line455"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line456"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;{Object...}&nbsp;values&nbsp;Arrays&nbsp;and/or&nbsp;values&nbsp;to&nbsp;concatenate&nbsp;to&nbsp;the&nbsp;resulting&nbsp;array.</span></span></span></div><div class="line"><a name="line457"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Array}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>New</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>array.</span></span></span></span></span></div><div class="line"><a name="line458"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line459"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line460"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line461"><a name="Array-method-join"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;join</span></span></span></div><div class="line"><a name="line462"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Joins&nbsp;all&nbsp;elements&nbsp;of&nbsp;an&nbsp;array&nbsp;into&nbsp;a&nbsp;string.</span></span></span></div><div class="line"><a name="line463"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line464"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;string&nbsp;conversions&nbsp;of&nbsp;all&nbsp;array&nbsp;elements&nbsp;are&nbsp;joined&nbsp;into&nbsp;one&nbsp;string.</span></span></span></div><div class="line"><a name="line465"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line466"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;creates&nbsp;an&nbsp;array,&nbsp;`a`,&nbsp;with&nbsp;three&nbsp;elements,&nbsp;then&nbsp;joins&nbsp;the&nbsp;array&nbsp;three&nbsp;times:</span></span></span></div><div class="line"><a name="line467"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;using&nbsp;the&nbsp;default&nbsp;separator,&nbsp;then&nbsp;a&nbsp;comma&nbsp;and&nbsp;a&nbsp;space,&nbsp;and&nbsp;then&nbsp;a&nbsp;plus.</span></span></span></div><div class="line"><a name="line468"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line469"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;a&nbsp;=&nbsp;new&nbsp;Array(&quot;Wind&quot;,&quot;Rain&quot;,&quot;Fire&quot;);</span></span></span></div><div class="line"><a name="line470"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;myVar1&nbsp;=&nbsp;a.join();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;assigns&nbsp;&quot;Wind,Rain,Fire&quot;&nbsp;to&nbsp;myVar1</span></span></span></div><div class="line"><a name="line471"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;myVar2&nbsp;=&nbsp;a.join(&quot;,&nbsp;&quot;);&nbsp;&nbsp;//&nbsp;assigns&nbsp;&quot;Wind,&nbsp;Rain,&nbsp;Fire&quot;&nbsp;to&nbsp;myVar2</span></span></span></div><div class="line"><a name="line472"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;myVar3&nbsp;=&nbsp;a.join(&quot;&nbsp;+&nbsp;&quot;);&nbsp;//&nbsp;assigns&nbsp;&quot;Wind&nbsp;+&nbsp;Rain&nbsp;+&nbsp;Fire&quot;&nbsp;to&nbsp;myVar3</span></span></span></div><div class="line"><a name="line473"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line474"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>separator</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>Specifies&nbsp;a&nbsp;string&nbsp;to&nbsp;separate&nbsp;each&nbsp;element&nbsp;of&nbsp;the&nbsp;array.&nbsp;The&nbsp;separator</span></span></span></span></span></div><div class="line"><a name="line475"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;is&nbsp;converted&nbsp;to&nbsp;a&nbsp;string&nbsp;if&nbsp;necessary.&nbsp;If&nbsp;omitted,&nbsp;the&nbsp;array&nbsp;elements&nbsp;are&nbsp;separated&nbsp;with&nbsp;a&nbsp;comma.</span></span></span></div><div class="line"><a name="line476"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>A</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>string&nbsp;of&nbsp;the&nbsp;array&nbsp;elements.</span></span></span></span></span></div><div class="line"><a name="line477"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line478"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line479"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line480"><a name="Array-method-slice"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;slice</span></span></span></div><div class="line"><a name="line481"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Extracts&nbsp;a&nbsp;section&nbsp;of&nbsp;an&nbsp;array&nbsp;and&nbsp;returns&nbsp;a&nbsp;new&nbsp;array.</span></span></span></div><div class="line"><a name="line482"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line483"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`slice`&nbsp;does&nbsp;not&nbsp;alter&nbsp;the&nbsp;original&nbsp;array,&nbsp;but&nbsp;returns&nbsp;a&nbsp;new&nbsp;&quot;one&nbsp;level&nbsp;deep&quot;&nbsp;copy&nbsp;that&nbsp;contains</span></span></span></div><div class="line"><a name="line484"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;copies&nbsp;of&nbsp;the&nbsp;elements&nbsp;sliced&nbsp;from&nbsp;the&nbsp;original&nbsp;array.&nbsp;Elements&nbsp;of&nbsp;the&nbsp;original&nbsp;array&nbsp;are&nbsp;copied</span></span></span></div><div class="line"><a name="line485"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;into&nbsp;the&nbsp;new&nbsp;array&nbsp;as&nbsp;follows:</span></span></span></div><div class="line"><a name="line486"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;*&nbsp;&nbsp;&nbsp;For&nbsp;object&nbsp;references&nbsp;(and&nbsp;not&nbsp;the&nbsp;actual&nbsp;object),&nbsp;`slice`&nbsp;copies&nbsp;object&nbsp;references&nbsp;into&nbsp;the</span></span></span></div><div class="line"><a name="line487"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;new&nbsp;array.&nbsp;Both&nbsp;the&nbsp;original&nbsp;and&nbsp;new&nbsp;array&nbsp;refer&nbsp;to&nbsp;the&nbsp;same&nbsp;object.&nbsp;If&nbsp;a&nbsp;referenced&nbsp;object</span></span></span></div><div class="line"><a name="line488"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;changes,&nbsp;the&nbsp;changes&nbsp;are&nbsp;visible&nbsp;to&nbsp;both&nbsp;the&nbsp;new&nbsp;and&nbsp;original&nbsp;arrays.</span></span></span></div><div class="line"><a name="line489"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;*&nbsp;&nbsp;&nbsp;For&nbsp;strings&nbsp;and&nbsp;numbers&nbsp;(not&nbsp;{@link&nbsp;String}&nbsp;and&nbsp;{@link&nbsp;Number}&nbsp;objects),&nbsp;`slice`&nbsp;copies&nbsp;strings</span></span></span></div><div class="line"><a name="line490"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;and&nbsp;numbers&nbsp;into&nbsp;the&nbsp;new&nbsp;array.&nbsp;Changes&nbsp;to&nbsp;the&nbsp;string&nbsp;or&nbsp;number&nbsp;in&nbsp;one&nbsp;array&nbsp;does&nbsp;not&nbsp;affect&nbsp;the</span></span></span></div><div class="line"><a name="line491"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;other&nbsp;array.</span></span></span></div><div class="line"><a name="line492"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line493"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;a&nbsp;new&nbsp;element&nbsp;is&nbsp;added&nbsp;to&nbsp;either&nbsp;array,&nbsp;the&nbsp;other&nbsp;array&nbsp;is&nbsp;not&nbsp;affected.</span></span></span></div><div class="line"><a name="line494"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line495"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;###&nbsp;Using&nbsp;slice</span></span></span></div><div class="line"><a name="line496"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line497"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;In&nbsp;the&nbsp;following&nbsp;example,&nbsp;`slice`&nbsp;creates&nbsp;a&nbsp;new&nbsp;array,&nbsp;`newCar`,&nbsp;from&nbsp;`myCar`.&nbsp;Both&nbsp;include&nbsp;a</span></span></span></div><div class="line"><a name="line498"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;reference&nbsp;to&nbsp;the&nbsp;object&nbsp;`myHonda`.&nbsp;When&nbsp;the&nbsp;color&nbsp;of&nbsp;`myHonda`&nbsp;is&nbsp;changed&nbsp;to&nbsp;purple,&nbsp;both&nbsp;arrays</span></span></span></div><div class="line"><a name="line499"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;reflect&nbsp;the&nbsp;change.</span></span></span></div><div class="line"><a name="line500"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line501"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Using&nbsp;slice,&nbsp;create&nbsp;newCar&nbsp;from&nbsp;myCar.</span></span></span></div><div class="line"><a name="line502"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;myHonda&nbsp;=&nbsp;{&nbsp;color:&nbsp;&quot;red&quot;,&nbsp;wheels:&nbsp;4,&nbsp;engine:&nbsp;{&nbsp;cylinders:&nbsp;4,&nbsp;size:&nbsp;2.2&nbsp;}&nbsp;};</span></span></span></div><div class="line"><a name="line503"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;myCar&nbsp;=&nbsp;[myHonda,&nbsp;2,&nbsp;&quot;cherry&nbsp;condition&quot;,&nbsp;&quot;purchased&nbsp;1997&quot;];</span></span></span></div><div class="line"><a name="line504"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;newCar&nbsp;=&nbsp;myCar.slice(0,&nbsp;2);</span></span></span></div><div class="line"><a name="line505"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line506"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Print&nbsp;the&nbsp;values&nbsp;of&nbsp;myCar,&nbsp;newCar,&nbsp;and&nbsp;the&nbsp;color&nbsp;of&nbsp;myHonda</span></span></span></div><div class="line"><a name="line507"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;referenced&nbsp;from&nbsp;both&nbsp;arrays.</span></span></span></div><div class="line"><a name="line508"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;myCar&nbsp;=&nbsp;&quot;&nbsp;+&nbsp;myCar.toSource());</span></span></span></div><div class="line"><a name="line509"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;newCar&nbsp;=&nbsp;&quot;&nbsp;+&nbsp;newCar.toSource());</span></span></span></div><div class="line"><a name="line510"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;myCar[0].color&nbsp;=&nbsp;&quot;&nbsp;+&nbsp;myCar[0].color);</span></span></span></div><div class="line"><a name="line511"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;newCar[0].color&nbsp;=&nbsp;&quot;&nbsp;+&nbsp;newCar[0].color);</span></span></span></div><div class="line"><a name="line512"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line513"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Change&nbsp;the&nbsp;color&nbsp;of&nbsp;myHonda.</span></span></span></div><div class="line"><a name="line514"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myHonda.color&nbsp;=&nbsp;&quot;purple&quot;;</span></span></span></div><div class="line"><a name="line515"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;The&nbsp;new&nbsp;color&nbsp;of&nbsp;my&nbsp;Honda&nbsp;is&nbsp;&quot;&nbsp;+&nbsp;myHonda.color);</span></span></span></div><div class="line"><a name="line516"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line517"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Print&nbsp;the&nbsp;color&nbsp;of&nbsp;myHonda&nbsp;referenced&nbsp;from&nbsp;both&nbsp;arrays.</span></span></span></div><div class="line"><a name="line518"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;myCar[0].color&nbsp;=&nbsp;&quot;&nbsp;+&nbsp;myCar[0].color);</span></span></span></div><div class="line"><a name="line519"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;newCar[0].color&nbsp;=&nbsp;&quot;&nbsp;+&nbsp;newCar[0].color);</span></span></span></div><div class="line"><a name="line520"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line521"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;script&nbsp;writes:</span></span></span></div><div class="line"><a name="line522"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line523"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myCar&nbsp;=&nbsp;[{color:&quot;red&quot;,&nbsp;wheels:4,&nbsp;engine:{cylinders:4,&nbsp;size:2.2}},&nbsp;2,&nbsp;&quot;cherry&nbsp;condition&quot;,</span></span></span></div><div class="line"><a name="line524"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;purchased&nbsp;1997&quot;]</span></span></span></div><div class="line"><a name="line525"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newCar&nbsp;=&nbsp;[{color:&quot;red&quot;,&nbsp;wheels:4,&nbsp;engine:{cylinders:4,&nbsp;size:2.2}},&nbsp;2]</span></span></span></div><div class="line"><a name="line526"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myCar[0].color&nbsp;=&nbsp;red</span></span></span></div><div class="line"><a name="line527"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newCar[0].color&nbsp;=&nbsp;red</span></span></span></div><div class="line"><a name="line528"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;new&nbsp;color&nbsp;of&nbsp;my&nbsp;Honda&nbsp;is&nbsp;purple</span></span></span></div><div class="line"><a name="line529"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myCar[0].color&nbsp;=&nbsp;purple</span></span></span></div><div class="line"><a name="line530"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newCar[0].color&nbsp;=&nbsp;purple</span></span></span></div><div class="line"><a name="line531"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line532"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>begin</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>Zero-based&nbsp;index&nbsp;at&nbsp;which&nbsp;to&nbsp;begin&nbsp;extraction.</span></span></span></span></span></div><div class="line"><a name="line533"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;As&nbsp;a&nbsp;negative&nbsp;index,&nbsp;`start`&nbsp;indicates&nbsp;an&nbsp;offset&nbsp;from&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;sequence.&nbsp;`slice(-2)`&nbsp;extracts</span></span></span></div><div class="line"><a name="line534"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;second-to-last&nbsp;element&nbsp;and&nbsp;the&nbsp;last&nbsp;element&nbsp;in&nbsp;the&nbsp;sequence</span></span></span></div><div class="line"><a name="line535"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>end</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>Zero-based&nbsp;index&nbsp;at&nbsp;which&nbsp;to&nbsp;end&nbsp;extraction.&nbsp;`slice`&nbsp;extracts&nbsp;up&nbsp;to&nbsp;but&nbsp;not</span></span></span></span></span></div><div class="line"><a name="line536"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;including&nbsp;`end`.</span></span></span></div><div class="line"><a name="line537"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`slice(1,4)`&nbsp;extracts&nbsp;the&nbsp;second&nbsp;element&nbsp;through&nbsp;the&nbsp;fourth&nbsp;element&nbsp;(elements&nbsp;indexed&nbsp;1,&nbsp;2,&nbsp;and&nbsp;3).</span></span></span></div><div class="line"><a name="line538"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;As&nbsp;a&nbsp;negative&nbsp;index,&nbsp;end&nbsp;indicates&nbsp;an&nbsp;offset&nbsp;from&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;sequence.&nbsp;`slice(2,-1)`&nbsp;extracts</span></span></span></div><div class="line"><a name="line539"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;third&nbsp;element&nbsp;through&nbsp;the&nbsp;second-to-last&nbsp;element&nbsp;in&nbsp;the&nbsp;sequence.</span></span></span></div><div class="line"><a name="line540"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;`end`&nbsp;is&nbsp;omitted,&nbsp;`slice`&nbsp;extracts&nbsp;to&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;sequence.</span></span></span></div><div class="line"><a name="line541"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Array}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>Array</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>from&nbsp;the&nbsp;new&nbsp;start&nbsp;position&nbsp;up&nbsp;to&nbsp;(but&nbsp;not&nbsp;including)&nbsp;the&nbsp;specified&nbsp;end&nbsp;position.</span></span></span></span></span></div><div class="line"><a name="line542"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line543"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line544"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line545"><a name="Array-method-toString"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;toString</span></span></span></div><div class="line"><a name="line546"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Returns&nbsp;a&nbsp;string&nbsp;representing&nbsp;the&nbsp;array&nbsp;and&nbsp;its&nbsp;elements.&nbsp;Overrides&nbsp;the&nbsp;`Object.prototype.toString`</span></span></span></div><div class="line"><a name="line547"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;method.</span></span></span></div><div class="line"><a name="line548"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line549"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;{@link&nbsp;Array}&nbsp;object&nbsp;overrides&nbsp;the&nbsp;`toString`&nbsp;method&nbsp;of&nbsp;{@link&nbsp;Object}.&nbsp;For&nbsp;Array&nbsp;objects,&nbsp;the</span></span></span></div><div class="line"><a name="line550"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`toString`&nbsp;method&nbsp;joins&nbsp;the&nbsp;array&nbsp;and&nbsp;returns&nbsp;one&nbsp;string&nbsp;containing&nbsp;each&nbsp;array&nbsp;element&nbsp;separated&nbsp;by</span></span></span></div><div class="line"><a name="line551"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;commas.&nbsp;For&nbsp;example,&nbsp;the&nbsp;following&nbsp;code&nbsp;creates&nbsp;an&nbsp;array&nbsp;and&nbsp;uses&nbsp;`toString`&nbsp;to&nbsp;convert&nbsp;the&nbsp;array</span></span></span></div><div class="line"><a name="line552"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;to&nbsp;a&nbsp;string.</span></span></span></div><div class="line"><a name="line553"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line554"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;monthNames&nbsp;=&nbsp;new&nbsp;Array(&quot;Jan&quot;,&quot;Feb&quot;,&quot;Mar&quot;,&quot;Apr&quot;);</span></span></span></div><div class="line"><a name="line555"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myVar&nbsp;=&nbsp;monthNames.toString();&nbsp;//&nbsp;assigns&nbsp;&quot;Jan,Feb,Mar,Apr&quot;&nbsp;to&nbsp;myVar</span></span></span></div><div class="line"><a name="line556"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line557"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;JavaScript&nbsp;calls&nbsp;the&nbsp;`toString`&nbsp;method&nbsp;automatically&nbsp;when&nbsp;an&nbsp;array&nbsp;is&nbsp;to&nbsp;be&nbsp;represented&nbsp;as&nbsp;a&nbsp;text</span></span></span></div><div class="line"><a name="line558"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;value&nbsp;or&nbsp;when&nbsp;an&nbsp;array&nbsp;is&nbsp;referred&nbsp;to&nbsp;in&nbsp;a&nbsp;string&nbsp;concatenation.</span></span></span></div><div class="line"><a name="line559"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line560"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>The</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>array&nbsp;as&nbsp;a&nbsp;string.</span></span></span></span></span></div><div class="line"><a name="line561"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line562"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line563"><span class="source js"><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span>&nbsp;ECMAScript&nbsp;5&nbsp;methods</span><span>&nbsp;</span></span></span></div><div class="line"><a name="line564"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line565"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line566"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;isArray</span></span></span></div><div class="line"><a name="line567"><a name="Array-static-method-isArray"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@static</span></span></span></span></div><div class="line"><a name="line568"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Returns&nbsp;true&nbsp;if&nbsp;an&nbsp;object&nbsp;is&nbsp;an&nbsp;array,&nbsp;false&nbsp;if&nbsp;it&nbsp;is&nbsp;not.</span></span></span></div><div class="line"><a name="line569"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line570"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;all&nbsp;following&nbsp;calls&nbsp;return&nbsp;true</span></span></span></div><div class="line"><a name="line571"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Array.isArray([]);</span></span></span></div><div class="line"><a name="line572"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Array.isArray([1]);</span></span></span></div><div class="line"><a name="line573"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Array.isArray(&nbsp;new&nbsp;Array()&nbsp;);</span></span></span></div><div class="line"><a name="line574"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Array.isArray(&nbsp;Array.prototype&nbsp;);&nbsp;//&nbsp;Little&nbsp;known&nbsp;fact:&nbsp;Array.prototype&nbsp;itself&nbsp;is&nbsp;an&nbsp;array.</span></span></span></div><div class="line"><a name="line575"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line576"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;all&nbsp;following&nbsp;calls&nbsp;return&nbsp;false</span></span></span></div><div class="line"><a name="line577"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Array.isArray();</span></span></span></div><div class="line"><a name="line578"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Array.isArray({});</span></span></span></div><div class="line"><a name="line579"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Array.isArray(null);</span></span></span></div><div class="line"><a name="line580"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Array.isArray(undefined);</span></span></span></div><div class="line"><a name="line581"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Array.isArray(17);</span></span></span></div><div class="line"><a name="line582"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Array.isArray(&quot;Array&quot;);</span></span></span></div><div class="line"><a name="line583"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Array.isArray(true);</span></span></span></div><div class="line"><a name="line584"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Array.isArray(false);</span></span></span></div><div class="line"><a name="line585"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Array.isArray({&nbsp;__proto__&nbsp;:&nbsp;Array.prototype&nbsp;});</span></span></span></div><div class="line"><a name="line586"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line587"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;**NOTE:**&nbsp;This&nbsp;method&nbsp;is&nbsp;part&nbsp;of&nbsp;the&nbsp;ECMAScript&nbsp;5&nbsp;standard.</span></span></span></div><div class="line"><a name="line588"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line589"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Mixed}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>obj</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>The&nbsp;object&nbsp;to&nbsp;be&nbsp;checked.</span></span></span></span></span></div><div class="line"><a name="line590"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Boolean}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>True</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>when&nbsp;Array.</span></span></span></span></span></div><div class="line"><a name="line591"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line592"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line593"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line594"><a name="Array-method-indexOf"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;indexOf</span></span></span></div><div class="line"><a name="line595"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Returns&nbsp;the&nbsp;first&nbsp;index&nbsp;at&nbsp;which&nbsp;a&nbsp;given&nbsp;element&nbsp;can&nbsp;be&nbsp;found&nbsp;in&nbsp;the&nbsp;array,&nbsp;or&nbsp;-1&nbsp;if&nbsp;it&nbsp;is&nbsp;not&nbsp;present.</span></span></span></div><div class="line"><a name="line596"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line597"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`indexOf`&nbsp;compares&nbsp;`searchElement`&nbsp;to&nbsp;elements&nbsp;of&nbsp;the&nbsp;Array&nbsp;using&nbsp;strict&nbsp;equality&nbsp;(the&nbsp;same&nbsp;method&nbsp;used</span></span></span></div><div class="line"><a name="line598"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;by&nbsp;the&nbsp;`===`,&nbsp;or&nbsp;triple-equals,&nbsp;operator).</span></span></span></div><div class="line"><a name="line599"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line600"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;array&nbsp;=&nbsp;[2,&nbsp;5,&nbsp;9];</span></span></span></div><div class="line"><a name="line601"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;index&nbsp;=&nbsp;array.indexOf(2);</span></span></span></div><div class="line"><a name="line602"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;index&nbsp;is&nbsp;0</span></span></span></div><div class="line"><a name="line603"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;index&nbsp;=&nbsp;array.indexOf(7);</span></span></span></div><div class="line"><a name="line604"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;index&nbsp;is&nbsp;-1</span></span></span></div><div class="line"><a name="line605"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line606"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;**NOTE:**&nbsp;This&nbsp;method&nbsp;is&nbsp;part&nbsp;of&nbsp;the&nbsp;ECMAScript&nbsp;5&nbsp;standard.</span></span></span></div><div class="line"><a name="line607"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line608"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Mixed}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>searchElement</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>Element&nbsp;to&nbsp;locate&nbsp;in&nbsp;the&nbsp;array.</span></span></span></span></span></div><div class="line"><a name="line609"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;{Number}&nbsp;[fromIndex]&nbsp;The&nbsp;index&nbsp;at&nbsp;which&nbsp;to&nbsp;begin&nbsp;the&nbsp;search.&nbsp;Defaults&nbsp;to&nbsp;0,&nbsp;i.e.&nbsp;the&nbsp;whole&nbsp;array</span></span></span></div><div class="line"><a name="line610"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;will&nbsp;be&nbsp;searched.&nbsp;If&nbsp;the&nbsp;index&nbsp;is&nbsp;greater&nbsp;than&nbsp;or&nbsp;equal&nbsp;to&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;array,&nbsp;-1&nbsp;is&nbsp;returned,&nbsp;i.e.</span></span></span></div><div class="line"><a name="line611"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;array&nbsp;will&nbsp;not&nbsp;be&nbsp;searched.&nbsp;If&nbsp;negative,&nbsp;it&nbsp;is&nbsp;taken&nbsp;as&nbsp;the&nbsp;offset&nbsp;from&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;array.&nbsp;Note</span></span></span></div><div class="line"><a name="line612"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;that&nbsp;even&nbsp;when&nbsp;the&nbsp;index&nbsp;is&nbsp;negative,&nbsp;the&nbsp;array&nbsp;is&nbsp;still&nbsp;searched&nbsp;from&nbsp;front&nbsp;to&nbsp;back.&nbsp;If&nbsp;the&nbsp;calculated</span></span></span></div><div class="line"><a name="line613"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;index&nbsp;is&nbsp;less&nbsp;than&nbsp;0,&nbsp;the&nbsp;whole&nbsp;array&nbsp;will&nbsp;be&nbsp;searched.</span></span></span></div><div class="line"><a name="line614"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>The</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>index&nbsp;of&nbsp;element&nbsp;found&nbsp;or&nbsp;-1.</span></span></span></span></span></div><div class="line"><a name="line615"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line616"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line617"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line618"><a name="Array-method-lastIndexOf"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;lastIndexOf</span></span></span></div><div class="line"><a name="line619"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Returns&nbsp;the&nbsp;last&nbsp;index&nbsp;at&nbsp;which&nbsp;a&nbsp;given&nbsp;element&nbsp;can&nbsp;be&nbsp;found&nbsp;in&nbsp;the&nbsp;array,&nbsp;or&nbsp;-1&nbsp;if&nbsp;it&nbsp;is&nbsp;not&nbsp;present.</span></span></span></div><div class="line"><a name="line620"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;array&nbsp;is&nbsp;searched&nbsp;backwards,&nbsp;starting&nbsp;at&nbsp;`fromIndex`.</span></span></span></div><div class="line"><a name="line621"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line622"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`lastIndexOf`&nbsp;compares&nbsp;`searchElement`&nbsp;to&nbsp;elements&nbsp;of&nbsp;the&nbsp;Array&nbsp;using&nbsp;strict&nbsp;equality&nbsp;(the&nbsp;same&nbsp;method</span></span></span></div><div class="line"><a name="line623"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;used&nbsp;by&nbsp;the&nbsp;`===`,&nbsp;or&nbsp;triple-equals,&nbsp;operator).</span></span></span></div><div class="line"><a name="line624"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line625"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;array&nbsp;=&nbsp;[2,&nbsp;5,&nbsp;9,&nbsp;2];</span></span></span></div><div class="line"><a name="line626"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;index&nbsp;=&nbsp;array.lastIndexOf(2);</span></span></span></div><div class="line"><a name="line627"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;index&nbsp;is&nbsp;3</span></span></span></div><div class="line"><a name="line628"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;index&nbsp;=&nbsp;array.lastIndexOf(7);</span></span></span></div><div class="line"><a name="line629"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;index&nbsp;is&nbsp;-1</span></span></span></div><div class="line"><a name="line630"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;index&nbsp;=&nbsp;array.lastIndexOf(2,&nbsp;3);</span></span></span></div><div class="line"><a name="line631"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;index&nbsp;is&nbsp;3</span></span></span></div><div class="line"><a name="line632"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;index&nbsp;=&nbsp;array.lastIndexOf(2,&nbsp;2);</span></span></span></div><div class="line"><a name="line633"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;index&nbsp;is&nbsp;0</span></span></span></div><div class="line"><a name="line634"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;index&nbsp;=&nbsp;array.lastIndexOf(2,&nbsp;-2);</span></span></span></div><div class="line"><a name="line635"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;index&nbsp;is&nbsp;0</span></span></span></div><div class="line"><a name="line636"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;index&nbsp;=&nbsp;array.lastIndexOf(2,&nbsp;-1);</span></span></span></div><div class="line"><a name="line637"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;index&nbsp;is&nbsp;3</span></span></span></div><div class="line"><a name="line638"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line639"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;**NOTE:**&nbsp;This&nbsp;method&nbsp;is&nbsp;part&nbsp;of&nbsp;the&nbsp;ECMAScript&nbsp;5&nbsp;standard.</span></span></span></div><div class="line"><a name="line640"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line641"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Mixed}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>searchElement</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>Element&nbsp;to&nbsp;locate&nbsp;in&nbsp;the&nbsp;array.</span></span></span></span></span></div><div class="line"><a name="line642"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;{Number}&nbsp;[fromIndex]&nbsp;The&nbsp;index&nbsp;at&nbsp;which&nbsp;to&nbsp;start&nbsp;searching&nbsp;backwards.&nbsp;Defaults&nbsp;to&nbsp;the&nbsp;array&#39;s</span></span></span></div><div class="line"><a name="line643"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;length,&nbsp;i.e.&nbsp;the&nbsp;whole&nbsp;array&nbsp;will&nbsp;be&nbsp;searched.&nbsp;If&nbsp;the&nbsp;index&nbsp;is&nbsp;greater&nbsp;than&nbsp;or&nbsp;equal&nbsp;to&nbsp;the&nbsp;length&nbsp;of</span></span></span></div><div class="line"><a name="line644"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;array,&nbsp;the&nbsp;whole&nbsp;array&nbsp;will&nbsp;be&nbsp;searched.&nbsp;If&nbsp;negative,&nbsp;it&nbsp;is&nbsp;taken&nbsp;as&nbsp;the&nbsp;offset&nbsp;from&nbsp;the&nbsp;end&nbsp;of&nbsp;the</span></span></span></div><div class="line"><a name="line645"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;array.&nbsp;Note&nbsp;that&nbsp;even&nbsp;when&nbsp;the&nbsp;index&nbsp;is&nbsp;negative,&nbsp;the&nbsp;array&nbsp;is&nbsp;still&nbsp;searched&nbsp;from&nbsp;back&nbsp;to&nbsp;front.&nbsp;If</span></span></span></div><div class="line"><a name="line646"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;calculated&nbsp;index&nbsp;is&nbsp;less&nbsp;than&nbsp;0,&nbsp;-1&nbsp;is&nbsp;returned,&nbsp;i.e.&nbsp;the&nbsp;array&nbsp;will&nbsp;not&nbsp;be&nbsp;searched.</span></span></span></div><div class="line"><a name="line647"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>The</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>index&nbsp;of&nbsp;element&nbsp;found&nbsp;or&nbsp;-1.</span></span></span></span></span></div><div class="line"><a name="line648"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line649"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line650"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line651"><a name="Array-method-forEach"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;forEach</span></span></span></div><div class="line"><a name="line652"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Executes&nbsp;a&nbsp;provided&nbsp;function&nbsp;once&nbsp;per&nbsp;array&nbsp;element.</span></span></span></div><div class="line"><a name="line653"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line654"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`forEach`&nbsp;executes&nbsp;the&nbsp;provided&nbsp;function&nbsp;(`callback`)&nbsp;once&nbsp;for&nbsp;each&nbsp;element&nbsp;present&nbsp;in&nbsp;the&nbsp;array.&nbsp;`callback`</span></span></span></div><div class="line"><a name="line655"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;is&nbsp;invoked&nbsp;only&nbsp;for&nbsp;indexes&nbsp;of&nbsp;the&nbsp;array&nbsp;which&nbsp;have&nbsp;assigned&nbsp;values;&nbsp;it&nbsp;is&nbsp;not&nbsp;invoked&nbsp;for&nbsp;indexes&nbsp;which</span></span></span></div><div class="line"><a name="line656"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;have&nbsp;been&nbsp;deleted&nbsp;or&nbsp;which&nbsp;have&nbsp;never&nbsp;been&nbsp;assigned&nbsp;values.</span></span></span></div><div class="line"><a name="line657"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line658"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;a&nbsp;`thisArg`&nbsp;parameter&nbsp;is&nbsp;provided&nbsp;to&nbsp;`forEach`,&nbsp;it&nbsp;will&nbsp;be&nbsp;used&nbsp;as&nbsp;the&nbsp;`this`&nbsp;value&nbsp;for&nbsp;each&nbsp;`callback`</span></span></span></div><div class="line"><a name="line659"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;invocation&nbsp;as&nbsp;if&nbsp;`callback.call(thisArg,&nbsp;element,&nbsp;index,&nbsp;array)`&nbsp;was&nbsp;called.&nbsp;If&nbsp;`thisArg`&nbsp;is&nbsp;`undefined`&nbsp;or</span></span></span></div><div class="line"><a name="line660"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`null`,&nbsp;the&nbsp;`this`&nbsp;value&nbsp;within&nbsp;the&nbsp;function&nbsp;depends&nbsp;on&nbsp;whether&nbsp;the&nbsp;function&nbsp;is&nbsp;in&nbsp;strict&nbsp;mode&nbsp;or&nbsp;not</span></span></span></div><div class="line"><a name="line661"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;(passed&nbsp;value&nbsp;if&nbsp;in&nbsp;strict&nbsp;mode,&nbsp;global&nbsp;object&nbsp;if&nbsp;in&nbsp;non-strict&nbsp;mode).</span></span></span></div><div class="line"><a name="line662"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line663"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;`range`&nbsp;of&nbsp;elements&nbsp;processed&nbsp;by&nbsp;`forEach`&nbsp;is&nbsp;set&nbsp;before&nbsp;the&nbsp;first&nbsp;invocation&nbsp;of&nbsp;`callback`.&nbsp;Elements</span></span></span></div><div class="line"><a name="line664"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;which&nbsp;are&nbsp;appended&nbsp;to&nbsp;the&nbsp;array&nbsp;after&nbsp;the&nbsp;call&nbsp;to&nbsp;`forEach`&nbsp;begins&nbsp;will&nbsp;not&nbsp;be&nbsp;visited&nbsp;by&nbsp;`callback`.&nbsp;If</span></span></span></div><div class="line"><a name="line665"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;existing&nbsp;elements&nbsp;of&nbsp;the&nbsp;array&nbsp;are&nbsp;changed,&nbsp;or&nbsp;deleted,&nbsp;their&nbsp;value&nbsp;as&nbsp;passed&nbsp;to&nbsp;callback&nbsp;will&nbsp;be&nbsp;the</span></span></span></div><div class="line"><a name="line666"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;value&nbsp;at&nbsp;the&nbsp;time&nbsp;`forEach`&nbsp;visits&nbsp;them;&nbsp;elements&nbsp;that&nbsp;are&nbsp;deleted&nbsp;are&nbsp;not&nbsp;visited.</span></span></span></div><div class="line"><a name="line667"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line668"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;code&nbsp;logs&nbsp;a&nbsp;line&nbsp;for&nbsp;each&nbsp;element&nbsp;in&nbsp;an&nbsp;array:</span></span></span></div><div class="line"><a name="line669"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line670"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;logArrayElements(element,&nbsp;index,&nbsp;array)&nbsp;{</span></span></span></div><div class="line"><a name="line671"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;console.log(&quot;a[&quot;&nbsp;+&nbsp;index&nbsp;+&nbsp;&quot;]&nbsp;=&nbsp;&quot;&nbsp;+&nbsp;element);</span></span></span></div><div class="line"><a name="line672"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line673"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[2,&nbsp;5,&nbsp;9].forEach(logArrayElements);</span></span></span></div><div class="line"><a name="line674"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;logs:</span></span></span></div><div class="line"><a name="line675"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;a[0]&nbsp;=&nbsp;2</span></span></span></div><div class="line"><a name="line676"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;a[1]&nbsp;=&nbsp;5</span></span></span></div><div class="line"><a name="line677"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;a[2]&nbsp;=&nbsp;9</span></span></span></div><div class="line"><a name="line678"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line679"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;**NOTE:**&nbsp;This&nbsp;method&nbsp;is&nbsp;part&nbsp;of&nbsp;the&nbsp;ECMAScript&nbsp;5&nbsp;standard.</span></span></span></div><div class="line"><a name="line680"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line681"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Function}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>Function&nbsp;to&nbsp;execute&nbsp;for&nbsp;each&nbsp;element.</span></span></span></span></span></div><div class="line"><a name="line682"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Mixed}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.value&nbsp;The&nbsp;element&nbsp;value.</span></span></span></span></span></div><div class="line"><a name="line683"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.index&nbsp;The&nbsp;element&nbsp;index.</span></span></span></span></span></div><div class="line"><a name="line684"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Array}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.array&nbsp;The&nbsp;array&nbsp;being&nbsp;traversed.</span></span></span></span></span></div><div class="line"><a name="line685"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;{Object}&nbsp;[thisArg]&nbsp;Object&nbsp;to&nbsp;use&nbsp;as&nbsp;`this`&nbsp;when&nbsp;executing&nbsp;`callback`.</span></span></span></div><div class="line"><a name="line686"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line687"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line688"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line689"><a name="Array-method-every"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;every</span></span></span></div><div class="line"><a name="line690"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Tests&nbsp;whether&nbsp;all&nbsp;elements&nbsp;in&nbsp;the&nbsp;array&nbsp;pass&nbsp;the&nbsp;test&nbsp;implemented</span></span></span></div><div class="line"><a name="line691"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;by&nbsp;the&nbsp;provided&nbsp;function.</span></span></span></div><div class="line"><a name="line692"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line693"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`every`&nbsp;executes&nbsp;the&nbsp;provided&nbsp;`callback`&nbsp;function&nbsp;once&nbsp;for&nbsp;each&nbsp;element</span></span></span></div><div class="line"><a name="line694"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;present&nbsp;in&nbsp;the&nbsp;array&nbsp;until&nbsp;it&nbsp;finds&nbsp;one&nbsp;where&nbsp;`callback`&nbsp;returns&nbsp;a</span></span></span></div><div class="line"><a name="line695"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;false&nbsp;value.&nbsp;If&nbsp;such&nbsp;an&nbsp;element&nbsp;is&nbsp;found,&nbsp;the&nbsp;`every`&nbsp;method</span></span></span></div><div class="line"><a name="line696"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;immediately&nbsp;returns&nbsp;false.&nbsp;Otherwise,&nbsp;if&nbsp;`callback`&nbsp;returned&nbsp;a&nbsp;true</span></span></span></div><div class="line"><a name="line697"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;value&nbsp;for&nbsp;all&nbsp;elements,&nbsp;`every`&nbsp;will&nbsp;return&nbsp;true.&nbsp;`callback`&nbsp;is&nbsp;invoked</span></span></span></div><div class="line"><a name="line698"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;only&nbsp;for&nbsp;indexes&nbsp;of&nbsp;the&nbsp;array&nbsp;which&nbsp;have&nbsp;assigned&nbsp;values;&nbsp;it&nbsp;is&nbsp;not</span></span></span></div><div class="line"><a name="line699"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;invoked&nbsp;for&nbsp;indexes&nbsp;which&nbsp;have&nbsp;been&nbsp;deleted&nbsp;or&nbsp;which&nbsp;have&nbsp;never</span></span></span></div><div class="line"><a name="line700"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;been&nbsp;assigned&nbsp;values.</span></span></span></div><div class="line"><a name="line701"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line702"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;a&nbsp;`thisObject`&nbsp;parameter&nbsp;is&nbsp;provided&nbsp;to&nbsp;`every`,&nbsp;it&nbsp;will&nbsp;be&nbsp;used&nbsp;as</span></span></span></div><div class="line"><a name="line703"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;`this`&nbsp;for&nbsp;each&nbsp;invocation&nbsp;of&nbsp;the&nbsp;callback.&nbsp;If&nbsp;it&nbsp;is&nbsp;not</span></span></span></div><div class="line"><a name="line704"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;provided,&nbsp;or&nbsp;is&nbsp;`null`,&nbsp;the&nbsp;global&nbsp;object&nbsp;associated&nbsp;with&nbsp;callback&nbsp;is</span></span></span></div><div class="line"><a name="line705"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;used&nbsp;instead.</span></span></span></div><div class="line"><a name="line706"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line707"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`every`&nbsp;does&nbsp;not&nbsp;mutate&nbsp;the&nbsp;array&nbsp;on&nbsp;which&nbsp;it&nbsp;is&nbsp;called.</span></span></span></div><div class="line"><a name="line708"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line709"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;range&nbsp;of&nbsp;elements&nbsp;processed&nbsp;by&nbsp;`every`&nbsp;is&nbsp;set&nbsp;before&nbsp;the&nbsp;first</span></span></span></div><div class="line"><a name="line710"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;invocation&nbsp;of&nbsp;callback.&nbsp;Elements&nbsp;which&nbsp;are&nbsp;appended&nbsp;to&nbsp;the&nbsp;array</span></span></span></div><div class="line"><a name="line711"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;after&nbsp;the&nbsp;call&nbsp;to&nbsp;every&nbsp;begins&nbsp;will&nbsp;not&nbsp;be&nbsp;visited&nbsp;by&nbsp;`callback`.&nbsp;If</span></span></span></div><div class="line"><a name="line712"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;existing&nbsp;elements&nbsp;of&nbsp;the&nbsp;array&nbsp;are&nbsp;changed,&nbsp;their&nbsp;value&nbsp;as&nbsp;passed</span></span></span></div><div class="line"><a name="line713"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;to&nbsp;`callback`&nbsp;will&nbsp;be&nbsp;the&nbsp;value&nbsp;at&nbsp;the&nbsp;time&nbsp;`every`&nbsp;visits&nbsp;them;</span></span></span></div><div class="line"><a name="line714"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;elements&nbsp;that&nbsp;are&nbsp;deleted&nbsp;are&nbsp;not&nbsp;visited.</span></span></span></div><div class="line"><a name="line715"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line716"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`every`&nbsp;acts&nbsp;like&nbsp;the&nbsp;&quot;for&nbsp;all&quot;&nbsp;quantifier&nbsp;in&nbsp;mathematics.&nbsp;In</span></span></span></div><div class="line"><a name="line717"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;particular,&nbsp;for&nbsp;an&nbsp;empty&nbsp;array,&nbsp;it&nbsp;returns&nbsp;true.&nbsp;(It&nbsp;is&nbsp;vacuously</span></span></span></div><div class="line"><a name="line718"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;true&nbsp;that&nbsp;all&nbsp;elements&nbsp;of&nbsp;the&nbsp;empty&nbsp;set&nbsp;satisfy&nbsp;any&nbsp;given</span></span></span></div><div class="line"><a name="line719"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;condition.)</span></span></span></div><div class="line"><a name="line720"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line721"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;tests&nbsp;whether&nbsp;all&nbsp;elements&nbsp;in&nbsp;the&nbsp;array&nbsp;are</span></span></span></div><div class="line"><a name="line722"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;bigger&nbsp;than&nbsp;10.</span></span></span></div><div class="line"><a name="line723"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line724"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;isBigEnough(element,&nbsp;index,&nbsp;array)&nbsp;{</span></span></span></div><div class="line"><a name="line725"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;(element&nbsp;&gt;=&nbsp;10);</span></span></span></div><div class="line"><a name="line726"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line727"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;passed&nbsp;=&nbsp;[12,&nbsp;5,&nbsp;8,&nbsp;130,&nbsp;44].every(isBigEnough);</span></span></span></div><div class="line"><a name="line728"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;passed&nbsp;is&nbsp;false</span></span></span></div><div class="line"><a name="line729"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;passed&nbsp;=&nbsp;[12,&nbsp;54,&nbsp;18,&nbsp;130,&nbsp;44].every(isBigEnough);</span></span></span></div><div class="line"><a name="line730"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;passed&nbsp;is&nbsp;true</span></span></span></div><div class="line"><a name="line731"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line732"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;**NOTE:**&nbsp;This&nbsp;method&nbsp;is&nbsp;part&nbsp;of&nbsp;the&nbsp;ECMAScript&nbsp;5&nbsp;standard.</span></span></span></div><div class="line"><a name="line733"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line734"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Function}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>Function&nbsp;to&nbsp;test&nbsp;for&nbsp;each&nbsp;element.</span></span></span></span></span></div><div class="line"><a name="line735"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Mixed}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.value&nbsp;The&nbsp;element&nbsp;value.</span></span></span></span></span></div><div class="line"><a name="line736"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.index&nbsp;The&nbsp;element&nbsp;index.</span></span></span></span></span></div><div class="line"><a name="line737"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Array}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.array&nbsp;The&nbsp;array&nbsp;being&nbsp;traversed.</span></span></span></span></span></div><div class="line"><a name="line738"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Boolean}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.return&nbsp;Should&nbsp;return&nbsp;true&nbsp;when&nbsp;element&nbsp;passes&nbsp;the&nbsp;test.</span></span></span></span></span></div><div class="line"><a name="line739"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;{Object}&nbsp;[thisObject]&nbsp;Object&nbsp;to&nbsp;use&nbsp;as&nbsp;`this`&nbsp;when&nbsp;executing&nbsp;`callback`.</span></span></span></div><div class="line"><a name="line740"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Boolean}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>True</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>when&nbsp;all&nbsp;elements&nbsp;pass&nbsp;the&nbsp;test.</span></span></span></span></span></div><div class="line"><a name="line741"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line742"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line743"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line744"><a name="Array-method-some"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;some</span></span></span></div><div class="line"><a name="line745"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Tests&nbsp;whether&nbsp;some&nbsp;element&nbsp;in&nbsp;the&nbsp;array&nbsp;passes&nbsp;the&nbsp;test&nbsp;implemented</span></span></span></div><div class="line"><a name="line746"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;by&nbsp;the&nbsp;provided&nbsp;function.</span></span></span></div><div class="line"><a name="line747"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line748"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`some`&nbsp;executes&nbsp;the&nbsp;`callback`&nbsp;function&nbsp;once&nbsp;for&nbsp;each&nbsp;element</span></span></span></div><div class="line"><a name="line749"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;present&nbsp;in&nbsp;the&nbsp;array&nbsp;until&nbsp;it&nbsp;finds&nbsp;one&nbsp;where&nbsp;`callback`&nbsp;returns&nbsp;a</span></span></span></div><div class="line"><a name="line750"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;true&nbsp;value.&nbsp;If&nbsp;such&nbsp;an&nbsp;element&nbsp;is&nbsp;found,&nbsp;some&nbsp;immediately&nbsp;returns</span></span></span></div><div class="line"><a name="line751"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;true.&nbsp;Otherwise,&nbsp;some&nbsp;returns&nbsp;false.&nbsp;`callback`&nbsp;is&nbsp;invoked&nbsp;only&nbsp;for</span></span></span></div><div class="line"><a name="line752"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;indexes&nbsp;of&nbsp;the&nbsp;array&nbsp;which&nbsp;have&nbsp;assigned&nbsp;values;&nbsp;it&nbsp;is&nbsp;not&nbsp;invoked</span></span></span></div><div class="line"><a name="line753"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;for&nbsp;indexes&nbsp;which&nbsp;have&nbsp;been&nbsp;deleted&nbsp;or&nbsp;which&nbsp;have&nbsp;never&nbsp;been</span></span></span></div><div class="line"><a name="line754"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;assigned&nbsp;values.</span></span></span></div><div class="line"><a name="line755"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line756"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;a&nbsp;`thisObject`&nbsp;parameter&nbsp;is&nbsp;provided&nbsp;to&nbsp;some,&nbsp;it&nbsp;will&nbsp;be&nbsp;used&nbsp;as</span></span></span></div><div class="line"><a name="line757"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;`this`&nbsp;for&nbsp;each&nbsp;invocation&nbsp;of&nbsp;the&nbsp;`callback`.&nbsp;If&nbsp;it&nbsp;is&nbsp;not</span></span></span></div><div class="line"><a name="line758"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;provided,&nbsp;or&nbsp;is&nbsp;`null`,&nbsp;the&nbsp;global&nbsp;object&nbsp;associated&nbsp;with&nbsp;callback&nbsp;is</span></span></span></div><div class="line"><a name="line759"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;used&nbsp;instead.</span></span></span></div><div class="line"><a name="line760"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line761"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`some`&nbsp;does&nbsp;not&nbsp;mutate&nbsp;the&nbsp;array&nbsp;on&nbsp;which&nbsp;it&nbsp;is&nbsp;called.</span></span></span></div><div class="line"><a name="line762"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line763"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;range&nbsp;of&nbsp;elements&nbsp;processed&nbsp;by&nbsp;`some`&nbsp;is&nbsp;set&nbsp;before&nbsp;the&nbsp;first</span></span></span></div><div class="line"><a name="line764"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;invocation&nbsp;of&nbsp;callback.&nbsp;Elements&nbsp;that&nbsp;are&nbsp;appended&nbsp;to&nbsp;the&nbsp;array</span></span></span></div><div class="line"><a name="line765"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;after&nbsp;the&nbsp;call&nbsp;to&nbsp;some&nbsp;begins&nbsp;will&nbsp;not&nbsp;be&nbsp;visited&nbsp;by&nbsp;`callback`.&nbsp;If</span></span></span></div><div class="line"><a name="line766"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;an&nbsp;existing,&nbsp;unvisited&nbsp;element&nbsp;of&nbsp;the&nbsp;array&nbsp;is&nbsp;changed&nbsp;by&nbsp;`callback`,</span></span></span></div><div class="line"><a name="line767"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;its&nbsp;value&nbsp;passed&nbsp;to&nbsp;the&nbsp;visiting&nbsp;callback&nbsp;will&nbsp;be&nbsp;the&nbsp;value&nbsp;at&nbsp;the</span></span></span></div><div class="line"><a name="line768"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;time&nbsp;that&nbsp;`some`&nbsp;visits&nbsp;that&nbsp;element&#39;s&nbsp;index;&nbsp;elements&nbsp;that&nbsp;are</span></span></span></div><div class="line"><a name="line769"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;deleted&nbsp;are&nbsp;not&nbsp;visited.</span></span></span></div><div class="line"><a name="line770"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line771"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;tests&nbsp;whether&nbsp;some&nbsp;element&nbsp;in&nbsp;the&nbsp;array&nbsp;is</span></span></span></div><div class="line"><a name="line772"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;bigger&nbsp;than&nbsp;10.</span></span></span></div><div class="line"><a name="line773"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line774"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;isBigEnough(element,&nbsp;index,&nbsp;array)&nbsp;{</span></span></span></div><div class="line"><a name="line775"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;(element&nbsp;&gt;=&nbsp;10);</span></span></span></div><div class="line"><a name="line776"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line777"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;passed&nbsp;=&nbsp;[2,&nbsp;5,&nbsp;8,&nbsp;1,&nbsp;4].some(isBigEnough);</span></span></span></div><div class="line"><a name="line778"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;passed&nbsp;is&nbsp;false</span></span></span></div><div class="line"><a name="line779"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;passed&nbsp;=&nbsp;[12,&nbsp;5,&nbsp;8,&nbsp;1,&nbsp;4].some(isBigEnough);</span></span></span></div><div class="line"><a name="line780"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;passed&nbsp;is&nbsp;true</span></span></span></div><div class="line"><a name="line781"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line782"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;**NOTE:**&nbsp;This&nbsp;method&nbsp;is&nbsp;part&nbsp;of&nbsp;the&nbsp;ECMAScript&nbsp;5&nbsp;standard.</span></span></span></div><div class="line"><a name="line783"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line784"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Function}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>Function&nbsp;to&nbsp;test&nbsp;for&nbsp;each&nbsp;element.</span></span></span></span></span></div><div class="line"><a name="line785"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Mixed}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.value&nbsp;The&nbsp;element&nbsp;value.</span></span></span></span></span></div><div class="line"><a name="line786"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.index&nbsp;The&nbsp;element&nbsp;index.</span></span></span></span></span></div><div class="line"><a name="line787"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Array}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.array&nbsp;The&nbsp;array&nbsp;being&nbsp;traversed.</span></span></span></span></span></div><div class="line"><a name="line788"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Boolean}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.return&nbsp;Should&nbsp;return&nbsp;true&nbsp;when&nbsp;element&nbsp;passes&nbsp;the&nbsp;test.</span></span></span></span></span></div><div class="line"><a name="line789"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;{Object}&nbsp;[thisObject]&nbsp;Object&nbsp;to&nbsp;use&nbsp;as&nbsp;`this`&nbsp;when&nbsp;executing&nbsp;`callback`.</span></span></span></div><div class="line"><a name="line790"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Boolean}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>True</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>when&nbsp;at&nbsp;least&nbsp;one&nbsp;element&nbsp;passes&nbsp;the&nbsp;test.</span></span></span></span></span></div><div class="line"><a name="line791"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line792"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line793"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line794"><a name="Array-method-filter"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;filter</span></span></span></div><div class="line"><a name="line795"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Creates&nbsp;a&nbsp;new&nbsp;array&nbsp;with&nbsp;all&nbsp;elements&nbsp;that&nbsp;pass&nbsp;the&nbsp;test</span></span></span></div><div class="line"><a name="line796"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;implemented&nbsp;by&nbsp;the&nbsp;provided&nbsp;function.</span></span></span></div><div class="line"><a name="line797"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line798"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`filter`&nbsp;calls&nbsp;a&nbsp;provided&nbsp;`callback`&nbsp;function&nbsp;once&nbsp;for&nbsp;each&nbsp;element&nbsp;in</span></span></span></div><div class="line"><a name="line799"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;an&nbsp;array,&nbsp;and&nbsp;constructs&nbsp;a&nbsp;new&nbsp;array&nbsp;of&nbsp;all&nbsp;the&nbsp;values&nbsp;for&nbsp;which</span></span></span></div><div class="line"><a name="line800"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`callback`&nbsp;returns&nbsp;a&nbsp;true&nbsp;value.&nbsp;`callback`&nbsp;is&nbsp;invoked&nbsp;only&nbsp;for&nbsp;indexes</span></span></span></div><div class="line"><a name="line801"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;of&nbsp;the&nbsp;array&nbsp;which&nbsp;have&nbsp;assigned&nbsp;values;&nbsp;it&nbsp;is&nbsp;not&nbsp;invoked&nbsp;for</span></span></span></div><div class="line"><a name="line802"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;indexes&nbsp;which&nbsp;have&nbsp;been&nbsp;deleted&nbsp;or&nbsp;which&nbsp;have&nbsp;never&nbsp;been&nbsp;assigned</span></span></span></div><div class="line"><a name="line803"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;values.&nbsp;Array&nbsp;elements&nbsp;which&nbsp;do&nbsp;not&nbsp;pass&nbsp;the&nbsp;`callback`&nbsp;test&nbsp;are</span></span></span></div><div class="line"><a name="line804"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;simply&nbsp;skipped,&nbsp;and&nbsp;are&nbsp;not&nbsp;included&nbsp;in&nbsp;the&nbsp;new&nbsp;array.</span></span></span></div><div class="line"><a name="line805"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line806"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;a&nbsp;`thisObject`&nbsp;parameter&nbsp;is&nbsp;provided&nbsp;to&nbsp;`filter`,&nbsp;it&nbsp;will&nbsp;be</span></span></span></div><div class="line"><a name="line807"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;used&nbsp;as&nbsp;the&nbsp;`this`&nbsp;for&nbsp;each&nbsp;invocation&nbsp;of&nbsp;the&nbsp;`callback`.&nbsp;If&nbsp;it&nbsp;is&nbsp;not</span></span></span></div><div class="line"><a name="line808"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;provided,&nbsp;or&nbsp;is&nbsp;`null`,&nbsp;the&nbsp;global&nbsp;object&nbsp;associated&nbsp;with&nbsp;callback&nbsp;is</span></span></span></div><div class="line"><a name="line809"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;used&nbsp;instead.</span></span></span></div><div class="line"><a name="line810"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line811"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`filter`&nbsp;does&nbsp;not&nbsp;mutate&nbsp;the&nbsp;array&nbsp;on&nbsp;which&nbsp;it&nbsp;is&nbsp;called.</span></span></span></div><div class="line"><a name="line812"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line813"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;range&nbsp;of&nbsp;elements&nbsp;processed&nbsp;by&nbsp;`filter`&nbsp;is&nbsp;set&nbsp;before&nbsp;the&nbsp;first</span></span></span></div><div class="line"><a name="line814"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;invocation&nbsp;of&nbsp;`callback`.&nbsp;Elements&nbsp;which&nbsp;are&nbsp;appended&nbsp;to&nbsp;the&nbsp;array</span></span></span></div><div class="line"><a name="line815"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;after&nbsp;the&nbsp;call&nbsp;to&nbsp;`filter`&nbsp;begins&nbsp;will&nbsp;not&nbsp;be&nbsp;visited&nbsp;by&nbsp;`callback`.&nbsp;If</span></span></span></div><div class="line"><a name="line816"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;existing&nbsp;elements&nbsp;of&nbsp;the&nbsp;array&nbsp;are&nbsp;changed,&nbsp;or&nbsp;deleted,&nbsp;their&nbsp;value</span></span></span></div><div class="line"><a name="line817"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;as&nbsp;passed&nbsp;to&nbsp;`callback`&nbsp;will&nbsp;be&nbsp;the&nbsp;value&nbsp;at&nbsp;the&nbsp;time&nbsp;`filter`&nbsp;visits</span></span></span></div><div class="line"><a name="line818"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;them;&nbsp;elements&nbsp;that&nbsp;are&nbsp;deleted&nbsp;are&nbsp;not&nbsp;visited.</span></span></span></div><div class="line"><a name="line819"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line820"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;uses&nbsp;filter&nbsp;to&nbsp;create&nbsp;a&nbsp;filtered&nbsp;array&nbsp;that</span></span></span></div><div class="line"><a name="line821"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;has&nbsp;all&nbsp;elements&nbsp;with&nbsp;values&nbsp;less&nbsp;than&nbsp;10&nbsp;removed.</span></span></span></div><div class="line"><a name="line822"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line823"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;isBigEnough(element,&nbsp;index,&nbsp;array)&nbsp;{</span></span></span></div><div class="line"><a name="line824"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;(element&nbsp;&gt;=&nbsp;10);</span></span></span></div><div class="line"><a name="line825"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line826"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;filtered&nbsp;=&nbsp;[12,&nbsp;5,&nbsp;8,&nbsp;130,&nbsp;44].filter(isBigEnough);</span></span></span></div><div class="line"><a name="line827"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;filtered&nbsp;is&nbsp;[12,&nbsp;130,&nbsp;44]</span></span></span></div><div class="line"><a name="line828"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line829"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;**NOTE:**&nbsp;This&nbsp;method&nbsp;is&nbsp;part&nbsp;of&nbsp;the&nbsp;ECMAScript&nbsp;5&nbsp;standard.</span></span></span></div><div class="line"><a name="line830"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line831"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Function}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>Function&nbsp;to&nbsp;test&nbsp;for&nbsp;each&nbsp;element.</span></span></span></span></span></div><div class="line"><a name="line832"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Mixed}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.value&nbsp;The&nbsp;element&nbsp;value.</span></span></span></span></span></div><div class="line"><a name="line833"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.index&nbsp;The&nbsp;element&nbsp;index.</span></span></span></span></span></div><div class="line"><a name="line834"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Array}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.array&nbsp;The&nbsp;array&nbsp;being&nbsp;traversed.</span></span></span></span></span></div><div class="line"><a name="line835"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Boolean}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.return&nbsp;Should&nbsp;return&nbsp;true&nbsp;when&nbsp;element&nbsp;passes&nbsp;the&nbsp;test.</span></span></span></span></span></div><div class="line"><a name="line836"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;{Object}&nbsp;[thisObject]&nbsp;Object&nbsp;to&nbsp;use&nbsp;as&nbsp;`this`&nbsp;when&nbsp;executing&nbsp;`callback`.</span></span></span></div><div class="line"><a name="line837"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Array}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>Array</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>of&nbsp;elements&nbsp;that&nbsp;passed&nbsp;the&nbsp;test.</span></span></span></span></span></div><div class="line"><a name="line838"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line839"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line840"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line841"><a name="Array-method-map"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;map</span></span></span></div><div class="line"><a name="line842"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Creates&nbsp;a&nbsp;new&nbsp;array&nbsp;with&nbsp;the&nbsp;results&nbsp;of&nbsp;calling&nbsp;a&nbsp;provided&nbsp;function</span></span></span></div><div class="line"><a name="line843"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;on&nbsp;every&nbsp;element&nbsp;in&nbsp;this&nbsp;array.</span></span></span></div><div class="line"><a name="line844"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line845"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`map`&nbsp;calls&nbsp;a&nbsp;provided&nbsp;`callback`&nbsp;function&nbsp;once&nbsp;for&nbsp;each&nbsp;element&nbsp;in</span></span></span></div><div class="line"><a name="line846"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;an&nbsp;array,&nbsp;in&nbsp;order,&nbsp;and&nbsp;constructs&nbsp;a&nbsp;new&nbsp;array&nbsp;from&nbsp;the</span></span></span></div><div class="line"><a name="line847"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;results.&nbsp;`callback`&nbsp;is&nbsp;invoked&nbsp;only&nbsp;for&nbsp;indexes&nbsp;of&nbsp;the&nbsp;array&nbsp;which</span></span></span></div><div class="line"><a name="line848"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;have&nbsp;assigned&nbsp;values;&nbsp;it&nbsp;is&nbsp;not&nbsp;invoked&nbsp;for&nbsp;indexes&nbsp;which&nbsp;have&nbsp;been</span></span></span></div><div class="line"><a name="line849"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;deleted&nbsp;or&nbsp;which&nbsp;have&nbsp;never&nbsp;been&nbsp;assigned&nbsp;values.</span></span></span></div><div class="line"><a name="line850"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line851"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;a&nbsp;`thisArg`&nbsp;parameter&nbsp;is&nbsp;provided&nbsp;to&nbsp;map,&nbsp;it&nbsp;will&nbsp;be&nbsp;used&nbsp;as&nbsp;the</span></span></span></div><div class="line"><a name="line852"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`this`&nbsp;for&nbsp;each&nbsp;invocation&nbsp;of&nbsp;the&nbsp;`callback`.&nbsp;If&nbsp;it&nbsp;is&nbsp;not&nbsp;provided,&nbsp;or</span></span></span></div><div class="line"><a name="line853"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;is&nbsp;`null`,&nbsp;the&nbsp;global&nbsp;object&nbsp;associated&nbsp;with&nbsp;callback&nbsp;is&nbsp;used</span></span></span></div><div class="line"><a name="line854"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;instead.</span></span></span></div><div class="line"><a name="line855"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line856"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`map`&nbsp;does&nbsp;not&nbsp;mutate&nbsp;the&nbsp;array&nbsp;on&nbsp;which&nbsp;it&nbsp;is&nbsp;called.</span></span></span></div><div class="line"><a name="line857"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line858"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;range&nbsp;of&nbsp;elements&nbsp;processed&nbsp;by&nbsp;`map`&nbsp;is&nbsp;set&nbsp;before&nbsp;the&nbsp;first</span></span></span></div><div class="line"><a name="line859"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;invocation&nbsp;of&nbsp;`callback`.&nbsp;Elements&nbsp;which&nbsp;are&nbsp;appended&nbsp;to&nbsp;the&nbsp;array</span></span></span></div><div class="line"><a name="line860"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;after&nbsp;the&nbsp;call&nbsp;to&nbsp;`map`&nbsp;begins&nbsp;will&nbsp;not&nbsp;be&nbsp;visited&nbsp;by&nbsp;`callback`.&nbsp;If</span></span></span></div><div class="line"><a name="line861"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;existing&nbsp;elements&nbsp;of&nbsp;the&nbsp;array&nbsp;are&nbsp;changed,&nbsp;or&nbsp;deleted,&nbsp;their&nbsp;value</span></span></span></div><div class="line"><a name="line862"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;as&nbsp;passed&nbsp;to&nbsp;`callback`&nbsp;will&nbsp;be&nbsp;the&nbsp;value&nbsp;at&nbsp;the&nbsp;time&nbsp;`map`&nbsp;visits</span></span></span></div><div class="line"><a name="line863"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;them;&nbsp;elements&nbsp;that&nbsp;are&nbsp;deleted&nbsp;are&nbsp;not&nbsp;visited.</span></span></span></div><div class="line"><a name="line864"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line865"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;code&nbsp;creates&nbsp;an&nbsp;array&nbsp;of&nbsp;&quot;plural&quot;&nbsp;forms&nbsp;of&nbsp;nouns&nbsp;from</span></span></span></div><div class="line"><a name="line866"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;an&nbsp;array&nbsp;of&nbsp;their&nbsp;singular&nbsp;forms.</span></span></span></div><div class="line"><a name="line867"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line868"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;fuzzyPlural(single)&nbsp;{</span></span></span></div><div class="line"><a name="line869"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;result&nbsp;=&nbsp;single.replace(/o/g,&nbsp;&#39;e&#39;);</span></span></span></div><div class="line"><a name="line870"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;single&nbsp;===&nbsp;&#39;kangaroo&#39;){</span></span></span></div><div class="line"><a name="line871"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result&nbsp;+=&nbsp;&#39;se&#39;;</span></span></span></div><div class="line"><a name="line872"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line873"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;result;</span></span></span></div><div class="line"><a name="line874"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line875"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line876"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;words&nbsp;=&nbsp;[&quot;foot&quot;,&nbsp;&quot;goose&quot;,&nbsp;&quot;moose&quot;,&nbsp;&quot;kangaroo&quot;];</span></span></span></div><div class="line"><a name="line877"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;console.log(words.map(fuzzyPlural));</span></span></span></div><div class="line"><a name="line878"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line879"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;[&quot;feet&quot;,&nbsp;&quot;geese&quot;,&nbsp;&quot;meese&quot;,&nbsp;&quot;kangareese&quot;]</span></span></span></div><div class="line"><a name="line880"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line881"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;code&nbsp;takes&nbsp;an&nbsp;array&nbsp;of&nbsp;numbers&nbsp;and&nbsp;creates&nbsp;a&nbsp;new</span></span></span></div><div class="line"><a name="line882"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;array&nbsp;containing&nbsp;the&nbsp;square&nbsp;roots&nbsp;of&nbsp;the&nbsp;numbers&nbsp;in&nbsp;the&nbsp;first</span></span></span></div><div class="line"><a name="line883"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;array.</span></span></span></div><div class="line"><a name="line884"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line885"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;numbers&nbsp;=&nbsp;[1,&nbsp;4,&nbsp;9];</span></span></span></div><div class="line"><a name="line886"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;roots&nbsp;=&nbsp;numbers.map(Math.sqrt);</span></span></span></div><div class="line"><a name="line887"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;roots&nbsp;is&nbsp;now&nbsp;[1,&nbsp;2,&nbsp;3],&nbsp;numbers&nbsp;is&nbsp;still&nbsp;[1,&nbsp;4,&nbsp;9]</span></span></span></div><div class="line"><a name="line888"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line889"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;**NOTE:**&nbsp;This&nbsp;method&nbsp;is&nbsp;part&nbsp;of&nbsp;the&nbsp;ECMAScript&nbsp;5&nbsp;standard.</span></span></span></div><div class="line"><a name="line890"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line891"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Function}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>Function&nbsp;that&nbsp;produces&nbsp;an&nbsp;element&nbsp;of&nbsp;the&nbsp;new&nbsp;Array</span></span></span></span></span></div><div class="line"><a name="line892"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;from&nbsp;an&nbsp;element&nbsp;of&nbsp;the&nbsp;current&nbsp;one.</span></span></span></div><div class="line"><a name="line893"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Mixed}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.value&nbsp;The&nbsp;element&nbsp;value.</span></span></span></span></span></div><div class="line"><a name="line894"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.index&nbsp;The&nbsp;element&nbsp;index.</span></span></span></span></span></div><div class="line"><a name="line895"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Array}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.array&nbsp;The&nbsp;array&nbsp;being&nbsp;traversed.</span></span></span></span></span></div><div class="line"><a name="line896"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Boolean}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.return&nbsp;Should&nbsp;return&nbsp;true&nbsp;when&nbsp;element&nbsp;passes&nbsp;the&nbsp;test.</span></span></span></span></span></div><div class="line"><a name="line897"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;{Object}&nbsp;[thisObject]&nbsp;Object&nbsp;to&nbsp;use&nbsp;as&nbsp;`this`&nbsp;when&nbsp;executing&nbsp;`callback`.</span></span></span></div><div class="line"><a name="line898"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Array}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>Array</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>of&nbsp;the&nbsp;return&nbsp;values&nbsp;of&nbsp;`callback`&nbsp;function.</span></span></span></span></span></div><div class="line"><a name="line899"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line900"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line901"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line902"><a name="Array-method-reduce"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;reduce</span></span></span></div><div class="line"><a name="line903"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Applies&nbsp;a&nbsp;function&nbsp;against&nbsp;an&nbsp;accumulator&nbsp;and&nbsp;each&nbsp;value&nbsp;of&nbsp;the</span></span></span></div><div class="line"><a name="line904"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;array&nbsp;(from&nbsp;left-to-right)&nbsp;as&nbsp;to&nbsp;reduce&nbsp;it&nbsp;to&nbsp;a&nbsp;single&nbsp;value.</span></span></span></div><div class="line"><a name="line905"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line906"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`reduce`&nbsp;executes&nbsp;the&nbsp;`callback`&nbsp;function&nbsp;once&nbsp;for&nbsp;each&nbsp;element</span></span></span></div><div class="line"><a name="line907"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;present&nbsp;in&nbsp;the&nbsp;array,&nbsp;excluding&nbsp;holes&nbsp;in&nbsp;the&nbsp;array.</span></span></span></div><div class="line"><a name="line908"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line909"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;first&nbsp;time&nbsp;the&nbsp;`callback`&nbsp;is&nbsp;called,&nbsp;`previousValue`&nbsp;and</span></span></span></div><div class="line"><a name="line910"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`currentValue`&nbsp;can&nbsp;be&nbsp;one&nbsp;of&nbsp;two&nbsp;values.&nbsp;If&nbsp;`initialValue`&nbsp;is</span></span></span></div><div class="line"><a name="line911"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;provided&nbsp;in&nbsp;the&nbsp;call&nbsp;to&nbsp;`reduce`,&nbsp;then&nbsp;`previousValue`&nbsp;will&nbsp;be&nbsp;equal&nbsp;to</span></span></span></div><div class="line"><a name="line912"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`initialValue`&nbsp;and&nbsp;`currentValue`&nbsp;will&nbsp;be&nbsp;equal&nbsp;to&nbsp;the&nbsp;first&nbsp;value&nbsp;in</span></span></span></div><div class="line"><a name="line913"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;array.&nbsp;If&nbsp;no&nbsp;`initialValue`&nbsp;was&nbsp;provided,&nbsp;then&nbsp;`previousValue`&nbsp;will</span></span></span></div><div class="line"><a name="line914"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;be&nbsp;equal&nbsp;to&nbsp;the&nbsp;first&nbsp;value&nbsp;in&nbsp;the&nbsp;array&nbsp;and&nbsp;`currentValue`&nbsp;will&nbsp;be</span></span></span></div><div class="line"><a name="line915"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;equal&nbsp;to&nbsp;the&nbsp;second.</span></span></span></div><div class="line"><a name="line916"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line917"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Suppose&nbsp;the&nbsp;following&nbsp;use&nbsp;of&nbsp;reduce&nbsp;occurred:</span></span></span></div><div class="line"><a name="line918"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line919"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[0,1,2,3,4].reduce(function(previousValue,&nbsp;currentValue,&nbsp;index,&nbsp;array){</span></span></span></div><div class="line"><a name="line920"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;previousValue&nbsp;+&nbsp;currentValue;</span></span></span></div><div class="line"><a name="line921"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});</span></span></span></div><div class="line"><a name="line922"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line923"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;callback&nbsp;would&nbsp;be&nbsp;invoked&nbsp;four&nbsp;times,&nbsp;with&nbsp;the&nbsp;arguments&nbsp;and</span></span></span></div><div class="line"><a name="line924"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;return&nbsp;values&nbsp;in&nbsp;each&nbsp;call&nbsp;being&nbsp;as&nbsp;follows:</span></span></span></div><div class="line"><a name="line925"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line926"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;previousValue&nbsp;|&nbsp;currentValue&nbsp;|&nbsp;index&nbsp;|&nbsp;array&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;return&nbsp;value</span></span></span></div><div class="line"><a name="line927"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|:------------|:--------------|:-------------|:------|:------------|:------------</span></span></span></div><div class="line"><a name="line928"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;first&nbsp;call&nbsp;&nbsp;|&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;[0,1,2,3,4]&nbsp;|&nbsp;1</span></span></span></div><div class="line"><a name="line929"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;second&nbsp;call&nbsp;|&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;[0,1,2,3,4]&nbsp;|&nbsp;3</span></span></span></div><div class="line"><a name="line930"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;third&nbsp;call&nbsp;&nbsp;|&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;[0,1,2,3,4]&nbsp;|&nbsp;6</span></span></span></div><div class="line"><a name="line931"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;fourth&nbsp;call&nbsp;|&nbsp;6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;[0,1,2,3,4]&nbsp;|&nbsp;10</span></span></span></div><div class="line"><a name="line932"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line933"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;value&nbsp;returned&nbsp;by&nbsp;`reduce`&nbsp;would&nbsp;be&nbsp;that&nbsp;of&nbsp;the&nbsp;last&nbsp;callback</span></span></span></div><div class="line"><a name="line934"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;invocation&nbsp;(10).</span></span></span></div><div class="line"><a name="line935"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line936"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;you&nbsp;were&nbsp;to&nbsp;provide&nbsp;an&nbsp;initial&nbsp;value&nbsp;as&nbsp;the&nbsp;second&nbsp;argument&nbsp;to</span></span></span></div><div class="line"><a name="line937"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;reduce,&nbsp;the&nbsp;result&nbsp;would&nbsp;look&nbsp;like&nbsp;this:</span></span></span></div><div class="line"><a name="line938"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line939"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[0,1,2,3,4].reduce(function(previousValue,&nbsp;currentValue,&nbsp;index,&nbsp;array){</span></span></span></div><div class="line"><a name="line940"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;previousValue&nbsp;+&nbsp;currentValue;</span></span></span></div><div class="line"><a name="line941"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;10);</span></span></span></div><div class="line"><a name="line942"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line943"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;previousValue&nbsp;|&nbsp;currentValue&nbsp;|&nbsp;index&nbsp;|&nbsp;array&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;return&nbsp;value</span></span></span></div><div class="line"><a name="line944"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|:------------|:--------------|:-------------|:------|:------------|:------------</span></span></span></div><div class="line"><a name="line945"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;first&nbsp;call&nbsp;&nbsp;|&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;[0,1,2,3,4]&nbsp;|&nbsp;10</span></span></span></div><div class="line"><a name="line946"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;second&nbsp;call&nbsp;|&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;[0,1,2,3,4]&nbsp;|&nbsp;11</span></span></span></div><div class="line"><a name="line947"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;third&nbsp;call&nbsp;&nbsp;|&nbsp;11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;[0,1,2,3,4]&nbsp;|&nbsp;13</span></span></span></div><div class="line"><a name="line948"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;fourth&nbsp;call&nbsp;|&nbsp;13&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;[0,1,2,3,4]&nbsp;|&nbsp;16</span></span></span></div><div class="line"><a name="line949"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;fifth&nbsp;call&nbsp;&nbsp;|&nbsp;16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;[0,1,2,3,4]&nbsp;|&nbsp;20</span></span></span></div><div class="line"><a name="line950"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line951"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;value&nbsp;returned&nbsp;by&nbsp;`reduce`&nbsp;this&nbsp;time&nbsp;would&nbsp;be,&nbsp;of&nbsp;course,&nbsp;20.</span></span></span></div><div class="line"><a name="line952"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line953"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Example:&nbsp;Sum&nbsp;up&nbsp;all&nbsp;values&nbsp;within&nbsp;an&nbsp;array:</span></span></span></div><div class="line"><a name="line954"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line955"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;total&nbsp;=&nbsp;[0,&nbsp;1,&nbsp;2,&nbsp;3].reduce(function(a,&nbsp;b)&nbsp;{</span></span></span></div><div class="line"><a name="line956"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;a&nbsp;+&nbsp;b;</span></span></span></div><div class="line"><a name="line957"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});</span></span></span></div><div class="line"><a name="line958"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;total&nbsp;==&nbsp;6</span></span></span></div><div class="line"><a name="line959"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line960"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Example:&nbsp;Flatten&nbsp;an&nbsp;array&nbsp;of&nbsp;arrays:</span></span></span></div><div class="line"><a name="line961"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line962"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;flattened&nbsp;=&nbsp;[[0,&nbsp;1],&nbsp;[2,&nbsp;3],&nbsp;[4,&nbsp;5]].reduce(function(a,&nbsp;b)&nbsp;{</span></span></span></div><div class="line"><a name="line963"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;a.concat(b);</span></span></span></div><div class="line"><a name="line964"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});</span></span></span></div><div class="line"><a name="line965"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;flattened&nbsp;is&nbsp;[0,&nbsp;1,&nbsp;2,&nbsp;3,&nbsp;4,&nbsp;5]</span></span></span></div><div class="line"><a name="line966"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line967"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;**NOTE:**&nbsp;This&nbsp;method&nbsp;is&nbsp;part&nbsp;of&nbsp;the&nbsp;ECMAScript&nbsp;5&nbsp;standard.</span></span></span></div><div class="line"><a name="line968"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line969"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Function}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>Function&nbsp;to&nbsp;execute&nbsp;on&nbsp;each&nbsp;value&nbsp;in&nbsp;the&nbsp;array.</span></span></span></span></span></div><div class="line"><a name="line970"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Mixed}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.previousValue&nbsp;The&nbsp;value&nbsp;previously&nbsp;returned&nbsp;in&nbsp;the&nbsp;last</span></span></span></span></span></div><div class="line"><a name="line971"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;invocation&nbsp;of&nbsp;the&nbsp;`callback`,&nbsp;or&nbsp;`initialValue`,&nbsp;if&nbsp;supplied.</span></span></span></div><div class="line"><a name="line972"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Mixed}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.currentValue&nbsp;The&nbsp;current&nbsp;element&nbsp;being&nbsp;processed&nbsp;in&nbsp;the&nbsp;array.</span></span></span></span></span></div><div class="line"><a name="line973"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.index&nbsp;The&nbsp;index&nbsp;of&nbsp;the&nbsp;current&nbsp;element&nbsp;being&nbsp;processed&nbsp;in&nbsp;the&nbsp;array.</span></span></span></span></span></div><div class="line"><a name="line974"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Array}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.array&nbsp;The&nbsp;array&nbsp;`reduce`&nbsp;was&nbsp;called&nbsp;upon.</span></span></span></span></span></div><div class="line"><a name="line975"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;{Mixed}&nbsp;[initialValue]&nbsp;Object&nbsp;to&nbsp;use&nbsp;as&nbsp;the&nbsp;first&nbsp;argument&nbsp;to&nbsp;the&nbsp;first&nbsp;call</span></span></span></div><div class="line"><a name="line976"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;of&nbsp;the&nbsp;`callback`.</span></span></span></div><div class="line"><a name="line977"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Mixed}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>The</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>value&nbsp;returned&nbsp;by&nbsp;final&nbsp;invocation&nbsp;of&nbsp;the&nbsp;`callback`.</span></span></span></span></span></div><div class="line"><a name="line978"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line979"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line980"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line981"><a name="Array-method-reduceRight"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;reduceRight</span></span></span></div><div class="line"><a name="line982"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Applies&nbsp;a&nbsp;function&nbsp;simultaneously&nbsp;against&nbsp;two&nbsp;values&nbsp;of&nbsp;the&nbsp;array</span></span></span></div><div class="line"><a name="line983"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;(from&nbsp;right-to-left)&nbsp;as&nbsp;to&nbsp;reduce&nbsp;it&nbsp;to&nbsp;a&nbsp;single&nbsp;value.</span></span></span></div><div class="line"><a name="line984"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line985"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`reduceRight`&nbsp;executes&nbsp;the&nbsp;`callback`&nbsp;function&nbsp;once&nbsp;for&nbsp;each</span></span></span></div><div class="line"><a name="line986"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;element&nbsp;present&nbsp;in&nbsp;the&nbsp;array,&nbsp;excluding&nbsp;holes&nbsp;in&nbsp;the&nbsp;array.</span></span></span></div><div class="line"><a name="line987"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line988"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;first&nbsp;time&nbsp;the&nbsp;`callback`&nbsp;is&nbsp;called,&nbsp;`previousValue`&nbsp;and</span></span></span></div><div class="line"><a name="line989"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`currentValue`&nbsp;can&nbsp;be&nbsp;one&nbsp;of&nbsp;two&nbsp;values.&nbsp;If&nbsp;`initialValue`&nbsp;is</span></span></span></div><div class="line"><a name="line990"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;provided&nbsp;in&nbsp;the&nbsp;call&nbsp;to&nbsp;`reduceRight`,&nbsp;then&nbsp;`previousValue`&nbsp;will&nbsp;be&nbsp;equal&nbsp;to</span></span></span></div><div class="line"><a name="line991"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`initialValue`&nbsp;and&nbsp;`currentValue`&nbsp;will&nbsp;be&nbsp;equal&nbsp;to&nbsp;the&nbsp;last&nbsp;value&nbsp;in</span></span></span></div><div class="line"><a name="line992"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;array.&nbsp;If&nbsp;no&nbsp;`initialValue`&nbsp;was&nbsp;provided,&nbsp;then&nbsp;`previousValue`&nbsp;will</span></span></span></div><div class="line"><a name="line993"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;be&nbsp;equal&nbsp;to&nbsp;the&nbsp;last&nbsp;value&nbsp;in&nbsp;the&nbsp;array&nbsp;and&nbsp;`currentValue`&nbsp;will&nbsp;be</span></span></span></div><div class="line"><a name="line994"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;equal&nbsp;to&nbsp;the&nbsp;second-to-last&nbsp;value.</span></span></span></div><div class="line"><a name="line995"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line996"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Some&nbsp;example&nbsp;run-throughs&nbsp;of&nbsp;the&nbsp;function&nbsp;would&nbsp;look&nbsp;like&nbsp;this:</span></span></span></div><div class="line"><a name="line997"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line998"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[0,&nbsp;1,&nbsp;2,&nbsp;3,&nbsp;4].reduceRight(function(previousValue,&nbsp;currentValue,&nbsp;index,&nbsp;array)&nbsp;{</span></span></span></div><div class="line"><a name="line999"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;previousValue&nbsp;+&nbsp;currentValue;</span></span></span></div><div class="line"><a name="line1000"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});</span></span></span></div><div class="line"><a name="line1001"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1002"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;First&nbsp;call</span></span></span></div><div class="line"><a name="line1003"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;previousValue&nbsp;=&nbsp;4,&nbsp;currentValue&nbsp;=&nbsp;3,&nbsp;index&nbsp;=&nbsp;3</span></span></span></div><div class="line"><a name="line1004"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1005"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Second&nbsp;call</span></span></span></div><div class="line"><a name="line1006"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;previousValue&nbsp;=&nbsp;7,&nbsp;currentValue&nbsp;=&nbsp;2,&nbsp;index&nbsp;=&nbsp;2</span></span></span></div><div class="line"><a name="line1007"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1008"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Third&nbsp;call</span></span></span></div><div class="line"><a name="line1009"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;previousValue&nbsp;=&nbsp;9,&nbsp;currentValue&nbsp;=&nbsp;1,&nbsp;index&nbsp;=&nbsp;1</span></span></span></div><div class="line"><a name="line1010"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1011"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Fourth&nbsp;call</span></span></span></div><div class="line"><a name="line1012"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;previousValue&nbsp;=&nbsp;10,&nbsp;currentValue&nbsp;=&nbsp;0,&nbsp;index&nbsp;=&nbsp;0</span></span></span></div><div class="line"><a name="line1013"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1014"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;array&nbsp;is&nbsp;always&nbsp;the&nbsp;object&nbsp;[0,1,2,3,4]&nbsp;upon&nbsp;which&nbsp;reduceRight&nbsp;was&nbsp;called</span></span></span></div><div class="line"><a name="line1015"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1016"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Return&nbsp;Value:&nbsp;10</span></span></span></div><div class="line"><a name="line1017"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1018"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;And&nbsp;if&nbsp;you&nbsp;were&nbsp;to&nbsp;provide&nbsp;an&nbsp;initialValue,&nbsp;the&nbsp;result&nbsp;would&nbsp;look&nbsp;like&nbsp;this:</span></span></span></div><div class="line"><a name="line1019"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1020"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[0,&nbsp;1,&nbsp;2,&nbsp;3,&nbsp;4].reduceRight(function(previousValue,&nbsp;currentValue,&nbsp;index,&nbsp;array)&nbsp;{</span></span></span></div><div class="line"><a name="line1021"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;previousValue&nbsp;+&nbsp;currentValue;</span></span></span></div><div class="line"><a name="line1022"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;10);</span></span></span></div><div class="line"><a name="line1023"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1024"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;First&nbsp;call</span></span></span></div><div class="line"><a name="line1025"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;previousValue&nbsp;=&nbsp;10,&nbsp;currentValue&nbsp;=&nbsp;4,&nbsp;index&nbsp;=&nbsp;4</span></span></span></div><div class="line"><a name="line1026"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1027"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Second&nbsp;call</span></span></span></div><div class="line"><a name="line1028"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;previousValue&nbsp;=&nbsp;14,&nbsp;currentValue&nbsp;=&nbsp;3,&nbsp;index&nbsp;=&nbsp;3</span></span></span></div><div class="line"><a name="line1029"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1030"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Third&nbsp;call</span></span></span></div><div class="line"><a name="line1031"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;previousValue&nbsp;=&nbsp;17,&nbsp;currentValue&nbsp;=&nbsp;2,&nbsp;index&nbsp;=&nbsp;2</span></span></span></div><div class="line"><a name="line1032"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1033"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Fourth&nbsp;call</span></span></span></div><div class="line"><a name="line1034"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;previousValue&nbsp;=&nbsp;19,&nbsp;currentValue&nbsp;=&nbsp;1,&nbsp;index&nbsp;=&nbsp;1</span></span></span></div><div class="line"><a name="line1035"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1036"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Fifth&nbsp;call</span></span></span></div><div class="line"><a name="line1037"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;previousValue&nbsp;=&nbsp;20,&nbsp;currentValue&nbsp;=&nbsp;0,&nbsp;index&nbsp;=&nbsp;0</span></span></span></div><div class="line"><a name="line1038"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1039"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;array&nbsp;is&nbsp;always&nbsp;the&nbsp;object&nbsp;[0,1,2,3,4]&nbsp;upon&nbsp;which&nbsp;reduceRight&nbsp;was&nbsp;called</span></span></span></div><div class="line"><a name="line1040"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1041"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Return&nbsp;Value:&nbsp;20</span></span></span></div><div class="line"><a name="line1042"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1043"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;**NOTE:**&nbsp;This&nbsp;method&nbsp;is&nbsp;part&nbsp;of&nbsp;the&nbsp;ECMAScript&nbsp;5&nbsp;standard.</span></span></span></div><div class="line"><a name="line1044"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1045"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Function}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>Function&nbsp;to&nbsp;execute&nbsp;on&nbsp;each&nbsp;value&nbsp;in&nbsp;the&nbsp;array.</span></span></span></span></span></div><div class="line"><a name="line1046"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Mixed}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.previousValue&nbsp;The&nbsp;value&nbsp;previously&nbsp;returned&nbsp;in&nbsp;the&nbsp;last</span></span></span></span></span></div><div class="line"><a name="line1047"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;invocation&nbsp;of&nbsp;the&nbsp;`callback`,&nbsp;or&nbsp;`initialValue`,&nbsp;if&nbsp;supplied.</span></span></span></div><div class="line"><a name="line1048"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Mixed}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.currentValue&nbsp;The&nbsp;current&nbsp;element&nbsp;being&nbsp;processed&nbsp;in&nbsp;the&nbsp;array.</span></span></span></span></span></div><div class="line"><a name="line1049"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.index&nbsp;The&nbsp;index&nbsp;of&nbsp;the&nbsp;current&nbsp;element&nbsp;being&nbsp;processed&nbsp;in&nbsp;the&nbsp;array.</span></span></span></span></span></div><div class="line"><a name="line1050"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Array}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>callback</span></span><span class="other description jsdoc"><span>.array&nbsp;The&nbsp;array&nbsp;`reduceRight`&nbsp;was&nbsp;called&nbsp;upon.</span></span></span></span></span></div><div class="line"><a name="line1051"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;{Mixed}&nbsp;[initialValue]&nbsp;Object&nbsp;to&nbsp;use&nbsp;as&nbsp;the&nbsp;first&nbsp;argument&nbsp;to&nbsp;the&nbsp;first&nbsp;call</span></span></span></div><div class="line"><a name="line1052"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;of&nbsp;the&nbsp;`callback`.</span></span></span></div><div class="line"><a name="line1053"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Mixed}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>The</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>value&nbsp;returned&nbsp;by&nbsp;final&nbsp;invocation&nbsp;of&nbsp;the&nbsp;`callback`.</span></span></span></span></span></div><div class="line"><a name="line1054"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div></pre>
</body>
<script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
                (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-1396058-28', 'auto');
    ga('send', 'pageview');

</script>
</html>
